1. Home
  2. Docs
  3. Doc of Payment Methods by...
  4. Shortcodes
  5. Shortcodes

Shortcodes

Payment Methods by Product & Country for WooCommerce: Shortcodes Guide

The shortcodes are categorized into Free and Pro versions, allowing you to manage and restrict payment gateways based on product categories, tags, countries, and more.


Free Version Shortcodes

  1. [alg_wc_pm_country]
    • Description: This shortcode allows you to display or restrict payment methods based on the customer’s country. It’s useful for payment options to specific geographical locations.
    • Parameters:
      • country: The country code (e.g., US, GB) to restrict or display the payment method.
      • include: Set to true to include payment methods for the specified country.
    • Example Usage: [alg_wc_pm_country country="US" include="true"]
    • Use Case: Display payment methods only for customers from specific countries, ensuring that only relevant options are available during checkout.
  2. [alg_wc_pm_category]
    • Description: This shortcode restricts payment methods based on product categories in the cart. It is particularly useful when certain payment methods are more suitable for specific types of products.
    • Parameters:
      • category: The slug or ID of the product category.
      • exclude: Set to true to exclude the payment method for the specified category.
    • Example Usage: [alg_wc_pm_category category="electronics" exclude="true"]
    • Use Case: Restrict certain payment methods (e.g., PayPal) for expensive product categories where fees are higher, encouraging customers to use lower-cost options like wire transfers.
  3. [alg_wc_pm_tag]
    • Description: This shortcode controls the visibility of payment methods based on product tags. It’s ideal for more granular control over payment methods for specific product groups.
    • Parameters:
      • tag: The slug or ID of the product tag.
      • include: Set to true to include the payment method for the specified tag.
    • Example Usage: [alg_wc_pm_tag tag="luxury" include="true"]
    • Use Case: Allow only specific payment methods for products tagged with certain attributes, such as “luxury” or “subscription”.

Pro Version Shortcodes

  1. [alg_wc_pm_product]
    • Description: This shortcode provides advanced control over payment methods based on individual products. It can be used to restrict or display payment methods for specific products or even variations.
    • Parameters:
      • product_id: The ID of the product to which the restriction applies.
      • exclude: Set to true to exclude the payment method for the specified product.
    • Example Usage: [alg_wc_pm_product product_id="123" exclude="true"]
    • Use Case: Restrict certain payment methods for high-value products, ensuring that customers use more secure or preferred payment options.
  2. [alg_wc_pm_fallback]
    • Description: This shortcode allows you to set a fallback payment method if conflicting rules result in no payment methods being available. It’s essential for ensuring a smooth checkout process even when multiple restrictions are in place.
    • Parameters:
      • fallback_method: The ID of the payment method to use as a fallback.
    • Example Usage: [alg_wc_pm_fallback fallback_method="bank_transfer"]
    • Use Case: Ensure that customers always have a payment option available, even when certain products or categories are restricted.
  3. [alg_wc_pm_country_advanced]
    • Description: This shortcode extends the basic country restriction capabilities by allowing complex rules based on multiple countries or regions.
    • Parameters:
      • countries: A comma-separated list of country codes.
      • exclude: Set to true to exclude the payment method for the specified countries.
    • Example Usage: [alg_wc_pm_country_advanced countries="US,CA,MX" exclude="true"]
    • Use Case: Restrict certain payment methods for customers from specific regions, optimizing payment processing fees and reducing fraud risk.

These shortcodes empower you to tailor the payment experience in your WooCommerce store, ensuring that customers are presented with the most appropriate payment options based on their location, the products they are purchasing, and other criteria. The Pro version of the plugin offers even more granular control, allowing for advanced configurations that can help you optimize your store’s operations and profitability.