Best Practice – Customise a WooCommerce+WordPress Templates

The best practice for editing a Woocommerce theme is similar to WordPress as you should use Hooks and Filters when possible. https://docs.woothemes.com/document/introduction-to-hooks-actions-and-filters/ But if you do need to edit a template Woocommerce outlines this on their website as well: https://docs.woothemes.com/document/template-structure/ You just need to make the template upgrade safe by copying the template to your … Read more

Debugging why featured images have stopped showing in WooCommerce on the homepage [closed]

These are WooCommerce 3.x instructions only. That thread on GitHub (https://github.com/woocommerce/woocommerce/issues/14914#issuecomment-299714488) was updated by one of the Woo devs and he provided an example loop and explained what is happening: Featured was meta in 2.6, but is a taxonomy (for performance!) in 3.0 – so adjust queries to use tax_query instead of meta_query accordingly. To … Read more

woocommerce – customise notice error in checkout page

The message itself is not filterable, so the simplest way to change it is to basically ‘translate’ it using the gettext filter: function wpse_284393_checkout_message( $translated_text, $text, $domain ) { if ( $domain !== ‘woocommerce’ ) { return $translated_text; } if ( $text=”Unfortunately <strong>we do not ship %s</strong>. Please enter an alternative shipping address.” ) { … Read more

I want to run a script only once on a ‘thank you’ page

You can use order post meta to check order already there or not. try below code. let me know if this helps you. $order_id = $order->get_id(); $fbpixel = get_post_meta($order_id, ‘fbpixel-‘.$order->get_order_number(),true); if ( $order->get_subtotal() > 0 && ( empty( $fbpixel ) ) ) : update_post_meta($order_id, ‘fbpixel-‘.$order->get_order_number(),1); ?> <script> fbq(‘track’, ‘Purchase’, {currency: “AUD”, value: <?php echo ($order->get_total() … Read more

WooCommerce Tax Filter Not Fired [closed]

Here is Link which may be useful to you. I have tested and it is working fine for me. you have to just take care of woocommerce settings https://prnt.sc/q6fse9. such as Prices entered with tax or not. add_action( ‘woocommerce_before_calculate_totals’, ‘apply_conditionally_zero_tax_rate’, 10, 1 ); function apply_conditionally_zero_tax_rate( $cart ) { if ( is_admin() && ! defined( ‘DOING_AJAX’ … Read more