How to make custom total price reactive in navigation

Using woocommerce woocommerce_add_to_cart_fragments filter you can do that. Going by the id attribute that you currently have for the span that displays the cart total, you can use the following code add_filter(‘woocommerce_add_to_cart_fragments’, ‘bt_update_cart_total’); function bt_update_cart_total ($fragments) { $fragments[‘#order-total-price’] = ‘<span id=”order-total-price”>’ . WC()->cart->get_cart_subtotal() . ‘</span>’; return $fragments; } Add this code to your functions.php file … Read more

Target WooCommerce Product Gallery Image (rather than Featured Image) for og:image

You will need to use the methods on one of the WooCommerce product object for example: function insert_fb_in_head() { global $post; if ( !is_singular()) //if it is not a post or a page return; echo ‘<meta property=”og:title” content=”‘ . get_the_title() . ‘”/>’; echo ‘<meta property=”og:type” content=”article”/>’; echo ‘<meta property=”og:url” content=”‘ . get_permalink() . ‘”/>’; echo … Read more

paypal not showing on woocommerce payments

Paypal standard is now hidden for new installs, possible to read about it in https://developer.woocommerce.com/2021/07/12/developer-advisory-paypal-standard-will-be-hidden-on-new-installs/ for those who want to use it copy paste this code on functions.php add_filter( ‘woocommerce_should_load_paypal_standard’, ‘__return_true’ ); Since july 2021 woocommerce recommends users to use the recommended PayPal extension instead

Programatically added attribute, set to ‘show on product page’ automatically. Woocommerce [closed]

It actually doesn’t matter because WooCommerce uses this, to display: $values = wc_get_product_terms( $product->id, $attribute[‘name’], array( ‘fields’ => ‘names’ ) ); However, if you don’t set the display to true, you’d have to add this code to your template files. You might have to do other things as well (styling, etc). If you just set … Read more

How to Use PHP Code In-Page?

There is almost never a scenario where executing PHP code entered from the wysiwyg editor is a good idea. It opens up a whole bunch of security issues. The best way to achieve what you are looking for is to setup a custom short code that will return the link you are interested in. Add … Read more

Can I remove WooCommerce main content hook?

remove_action(‘woocommerce_before_main_content’, ‘woocommerce_output_content_wrapper’, 10,0); remove_action(‘woocommerce_before_main_content’, ‘woocommerce_breadcrumb’, 20,0); remove_action(‘woocommerce_after_main_content’, ‘woocommerce_output_content_wrapper_end’, 10,0); I hope it works for you =)