Disable Order Review Page when the id product

function action_woocommerce_checkout_order_review() { // Product id $product_id = 50700; // Generate cart id $product_cart_id = WC()->cart->generate_cart_id( $product_id ); // Is product in cart $in_cart = WC()->cart->find_product_in_cart( $product_cart_id ); // Product found if ( $in_cart ) { remove_action( ‘woocommerce_checkout_order_review’, ‘woocommerce_order_review’, 10 ); } } add_action( ‘woocommerce_checkout_order_review’, ‘action_woocommerce_checkout_order_review’, 1, 0 );

Conditional Shipping Options if Certain Products are in Cart WooCommerce

My solution is based off of this source snippet: https://www.xadapter.com/woocommerce-hide-shipping-methods-if-items-of-specific-shipping-class-is-not-in-cart/ I created a new Shipping class in WooCommerce called “no-free-shipping” (the slug is important as this must be replaced in the code if you have something different.) In the functions.php file in your WordPress theme, add the following code: add_filter(‘woocommerce_package_rates’, ‘xa_hide_shipping_method_when_shipping_class_product_is_in_cart’, 10, 2); function xa_hide_shipping_method_when_shipping_class_product_is_in_cart($available_shipping_methods, … Read more

WooCommerce – Create multiple product tags via rest api endpoint

Putting aside whether you’re making the API request from and to the same site or not, I assume that the $woocommerce is an instance of Automattic\WooCommerce\Client. And you can use the batch endpoint for product tags (/wp-json/wc/v3/products/tags/batch) to create/update/delete multiple (by default, up to 100) product tags at a time. Here’s an example for creating … Read more

How to display a table below each product in product list/loop

The shop archive or in general any product-loop that passes through: woocommerce/templates/archive-product.php …or utilizes similar logic found in that template, by calling: wc_get_template_part( ‘content’, ‘product’ ); which retrieves the following template: woocommerce/templates/content-product.php …will then make available the following actions: Excerpt from: woocommerce/templates/content-product.php (version 3.6.0 at the time of this answer) /** * Hook: woocommerce_before_shop_loop_item. * … Read more

How do I get Woocommerce product variation name and variation description in a WP_Query?

OK, so soon after posting I came up with a working solution. With this code I get the price straight from the variation price field, not from the description field as I mentioned in my question. <?php $params = array(‘posts_per_page’ => -1, ‘post_type’ => ‘product_variation’, ‘order’ => ‘ASC’); $wc_query = new WP_Query($params); global $product; ?> … Read more

Woocommerce Sort by default variation price

get_variation_default_attributes and woocommerce_price are depreciated. This works for me. If I have set default attributes. function custom_variation_price( $price, $product ) { foreach($product->get_available_variations() as $pav){ $def=true; foreach($product->get_default_attributes() as $defkey=>$defval){ if($pav[‘attributes’][‘attribute_’.$defkey]!=$defval){ $def=false; } } if($def){ $price = $pav[‘display_price’]; } } return wc_price($price); }

Show icons or badges under title on product archives/category pages

So I was not able to solve my problem earlier, then I switched the plugin to “Category and Taxonomy Image” (by Aftab Hussain) and used the following code to display the icons on category/archive pages: add_action( ‘woocommerce_after_shop_loop_item’, ‘attribute_img_loop’, 20 ); function attribute_img_loop() { global $product; // Check that we got the instance of the WC_Product … Read more