View Categories

Multiple External Products URLs & Currencies Developer Reference

This reference covers the filters, actions, functions and meta keys in Multiple External Products URLs & Currencies for WooCommerce for developers who want to set currencies or link behavior with code. Store owners can configure everything at WPFactory > Advanced External Products without code.

Filters #

Filter Parameters Return
alg_wc_advanced_external_products_currency $currency (false), $product A currency code to use for this external product, or false to fall back to the All products currency or the store currency. Runs only when the Currency section is enabled.
alg_wc_advanced_external_products_link_single $open (false) true to open the single page buy button in a new tab. Checked only when the All Products Single option is off.
alg_wc_advanced_external_products_link_loop $open (false), $product true to open the archive buy button in a new tab. Checked only when the All Products Archives option is off.
alg_wc_aep_multiple_urls_single $show (true) false to stop the extra buy buttons on single pages.
alg_wc_aep_multiple_urls_loop $show (true) false to stop the extra buy buttons on archives.

With Pro, the per-product currency is applied at priority 10 on alg_wc_advanced_external_products_currency and returns false when the product field is Default. Hook in at a later priority and respect a non-false value if you want the product field to win.

Example: show USD for external products in the amazon-us category, unless a per-product currency is set.

add_filter( 'alg_wc_advanced_external_products_currency', function ( $currency, $product ) {
	if ( false === $currency && has_term( 'amazon-us', 'product_cat', $product->get_id() ) ) {
		return 'USD';
	}
	return $currency;
}, 20, 2 );

Example: open archive links in a new tab only for products tagged partner.

add_filter( 'alg_wc_advanced_external_products_link_loop', function ( $open, $product ) {
	return $open || has_term( 'partner', 'product_tag', $product->get_id() );
}, 20, 2 );

Actions #

Action Parameter Fires when
alg_wc_advanced_external_products_core_loaded Core object All enabled modules are loaded
alg_wc_aep_currency_module_loaded Currency module The Currency section is enabled and loaded
alg_wc_aep_links_module_loaded Links module The Links section is enabled and loaded
alg_wc_aep_multiple_urls_module_loaded Multiple URLs module The Multiple URLs section is enabled and loaded

Functions #

Function Returns
alg_wc_advanced_external_products() The main plugin instance. Modules are in ->core->modules (currency, links, multiple_urls).
alg_wc_aep_is_external_product( $product = false ) true if the product (or the current global product) is external.
alg_wc_aep_get_current_product( $product = false ) The given or current WC_Product, or false.

WooCommerce hooks used #

  • Currency: woocommerce_currency and woocommerce_currency_symbol at priority PHP_INT_MAX, based on the current post ID.
  • Links: woocommerce_before_add_to_cart_form, woocommerce_after_add_to_cart_form and woocommerce_loop_add_to_cart_link.
  • Multiple URLs: woocommerce_after_add_to_cart_form, woocommerce_after_shop_loop_item, woocommerce_product_add_to_cart_url, woocommerce_product_add_to_cart_text and woocommerce_product_single_add_to_cart_text.
  • Product fields: woocommerce_product_options_external and save_post_product.

Product meta keys #

Meta key Value
_alg_wc_aep_product_urls Extra URLs, one per line: url, url|button_text or url|button_text|option_label
_alg_wc_aep_product_urls_default_label Dropdown label for the main Product URL (Pro)
_alg_wc_external_product_currency Currency code, or empty for Default (Pro)
_alg_wc_external_product_link_new_tab_enabled yes, no or empty (Pro)
_alg_wc_external_product_link_loop_new_tab_enabled yes, no or empty (Pro)

Need a hand? Our team answers every ticket on the External Products URLs & Currencies support forum.