Disable add to cart button when product is out of stock

Here are some plugins which provide the facilities to hide “Add To Cart” buttons from the shop and single product page in woocommerce, [ https://wordpress.org/plugins/hide-add-to-cart-button/) ] [ https://wordpress.org/plugins/remove-add-to-cart-woocommerce/ ] These plugins will do, 1) Hide Add to Cart button from product single page. 2) Hide Add to Cart button from category page. 3) Hide Add … Read more

WooCommerce custom loop pagination on front page

Can you please try below code? $paged = ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) : 1; $woo_home_query = array( ‘post_type’ => ‘product’, ‘posts_per_page’ => $top_selling_products_nr, ‘meta_key’ => ‘total_sales’, ‘paged’ => $paged, ‘orderby’ => ‘meta_value_num’ ); <?php if ( $woo_home_query->have_posts() ) : ?> <div class=”products container grid-wrapper clear”> <div class=”row”> <?php while ( … Read more

How to get _POST variable on WooCommerce product page (form on homepage)

I think you can maybe use $_SESSIONS or a $_GET var. Option 1: (I think this will work best for you situation) function redirect_form() { if (isset($_POST[“var1”]) && !empty($_POST[“var1”]) && isset($_POST[“var2”]) && isset($_POST[“var3”]) && !empty($_POST[“var3”])) { $_SESSION[‘var2’] = htmlentities(stripslashes(trim($_POST[“var2”])), ENT_QUOTES); if ($_POST[“var1”] == ‘product1’){ wp_redirect(home_url(‘/products/product1/’)); exit; ///// And In your price adjustment call function return_custom_price($price, … Read more

WP_Query wooCommerce category

You can try the following code to check whether a category with a name exist of not $search_category_name=”T-shirts”; //This gets top layer terms only. This is done by setting parent to 0. $parent_terms = get_terms(‘product_cat’, array(‘orderby’ => ‘slug’, ‘hide_empty’ => false)); foreach ($parent_terms as $pterm) { //check whether the category_name exists if ($search_category_name == $pterm->name) … Read more

Custom Woocommerce Category view

If you create your own shortcode based on the product category shortcode function duck_product_categories( $atts ) { global $woocommerce_loop; $atts = shortcode_atts( array( ‘number’ => null, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘columns’ => ‘4’, ‘hide_empty’ => 1, ‘parent’ => ”, ‘ids’ => ” ), $atts ); if ( isset( $atts[‘ids’] ) ) { $ids … Read more