add_filter to modify woocommerce_cart_item_name hyperlink

The key is to pass arguments to the callback function. Try this: /* Function that returns custom product hyperlink */ function wc_cart_item_name_hyperlink( $link_text, $product_data ) { $title = get_the_title($product_data[‘product_id’]); return sprintf( ‘<a href=”https://wordpress.stackexchange.com/questions/216353/%s”>%s </a>’,’example.com/mypage/’,$title ); } /* Filter to override cart_item_name */ add_filter( ‘woocommerce_cart_item_name’, ‘wc_cart_item_name_hyperlink’, 10, 2 ); The $product_data parameter is an array that … Read more

Move payment options at checkout in WooCommerce [closed]

You can customize the checkout page using hooks. To remove the payment options add the following code to your (child)theme’s functions.php: remove_action( ‘woocommerce_checkout_order_review’, ‘woocommerce_checkout_payment’, 20 ); To add it after the order notes use this hook: add_action( ‘woocommerce_after_order_notes’, ‘woocommerce_checkout_payment’, 20 );

Correct function to get the user’s latest Woocommerce Subscription?

use this code $users_subscriptions = wcs_get_users_subscriptions($user_id); retrieve the data using foreach foreach ($users_subscriptions as $subscription){ if ($subscription->has_status(array(‘active’))) { echo $subscription->get_id(); } } There is some function to access subscription data. like get_id(),get_date(‘end’) (to get last date of subscription ). I hope its help you well.

wc_get_template_part( ‘content’, ‘product’ ) | Where is this file located?

As mentioned in the comments, wc_get_template_part() tries to locate and load the requested template file. These template files could be ether in the /woocommerce/ sub-directory of a child-theme, or defined in another third party plugin (with the help of woocommerce_locate_template filter hook). If none of these exists, WC loads the default template file from /plugins/woocommerce/templates/ … Read more

Is it possible to add custom fields to a WooCommerce attribute term? [closed]

Yes, it is possible. And there’s an easy guide here. Below is a working code you can add to the theme’s main functions.php file: // Adds a custom rule type. add_filter( ‘acf/location/rule_types’, function( $choices ){ $choices[ __(“Other”,’acf’) ][‘wc_prod_attr’] = ‘WC Product Attribute’; return $choices; } ); // Adds custom rule values. add_filter( ‘acf/location/rule_values/wc_prod_attr’, function( $choices … Read more

WooCommerce get physical store address

The physical address of the store (and many other settings) are stored in WP’s options table (wp_options where “wp_” is the table prefix being used on the site). The option names are: woocommerce_store_address woocommerce_store_address_2 woocommerce_store_city woocommerce_store_postcode woocommerce_default_country The tricky thing is the woocommerce_default_country value. That stores the country AND state/province info depending on your selection … Read more