Customizing WooCommerce

What you are looking is variable product. You can create variation “Color” & “Fragrance”. in variable products When you are creating a product in backend you can select a product type as variable and add variations. You can see an example below

Disable variations on woo commerce if out of stock

Managed to solve my own issue. Simply paste the following into functions.php function custom_wc_ajax_variation_threshold( $qty, $product ) { return 10; } add_filter( ‘woocommerce_ajax_variation_threshold’, ‘custom_wc_ajax_variation_threshold’, 10, 2 ); Then change the ‘return 10;’ to however many variations you have. Please note this may slow down page loading time depending on your hosting.

Append woocommerce category to product title globally? [closed]

WooCommerce uses a single hook to display many things and just changing the hook priorities change the order of elements. Just change the hook and their order to achieve your goal. add_action( ‘woocommerce_single_product_summary’, ‘my_add_product_cat’, 6); add_action( ‘woocommerce_shop_loop_item_title’, ‘my_add_product_cat’, 11); I have given woocommerce_single_product_summary priority to 6 because single product title displayed at same hook with … Read more

Private post hidden from Admin too

By default, WordPress posts set to private are visible to admins, and you can distinguish them on the frontend because they have ‘Private:’ prepended to their title. However, you might have plugins installed that are modifying this behaviour. It could be your capability management plugin, or it could be WooCommerce. The specifics of third-party plugins … Read more

How add body_class from wp_termmeta

First check it is product category archive page using is_tax Then use get queried object_id to get the current term ID Then after you can use get_term_meta to get class name. Example: add_filter( ‘body_class’, ‘lalka_custom_taxonomy_in_body_class’ ); function lalka_custom_taxonomy_in_body_class( $classes ){ if (is_tax(‘product_cat’)) { $custom_class = !empty( get_queried_object_id() ) ? get_term_meta(get_queried_object_id(), ‘custom-class’, true) : FALSE; if … Read more

Restore woocommerce orders

It’s Simple. Step 1: Create a replica of the instance. Step 2: Import the old .sql file which contained one day lost orders data. Step 3: Use https://wordpress.org/plugins/woocommerce-simply-order-export/ plugin and export CSV or XML of 1 day data which you have lost. Step 4: Install the above plugin in the LIVE instance and import the … Read more