Viewing 13 replies - 1 through 13 (of 13 total)
  • So basically you want to shut off the Add to Cart button? Is that correct? If so you could use a plugin to make it into a catalog like site.

    Thread Starter cinakh10

    (@cinakh10)

    hi stef
    no, i want exactly show price range to customer without define variation product, please see below link:
    https://www.alibaba.com/product-detail/PVC-Background-Paper-Scrub-Photography-Backdrop_60708800421.html?spm=a27aq.13957220.60708800421.1.7b93516czMtvQJ

    up link site show price range without define variation product

    I visited that link, please don’t keep posting it. The only thing not there is an add to cart button.

    Thread Starter cinakh10

    (@cinakh10)

    no
    i want show price range without using variation product

    So simply choose “simple” product when creating products. Don’t choose variable.

    Thread Starter cinakh10

    (@cinakh10)

    in simple product just define one price , i want define 2price(min-max) price per product

    Plugin Support Fernando a11n

    (@fhaps)

    Automattic Happiness Engineer

    @cinakh10 It sounds like you are wanting to have a price range appear on product pages, but without actually having variations for the customer to select.

    I’m struggling to understand how would this work. What would you like to see happen when the customer adds the product to their cart? What price, from that price range, will actually be charged to the customer at checkout?

    Thread Starter cinakh10

    (@cinakh10)

    @fhaps There is no shopping cart and only the customer sees the price range and only calls to buy.

    Plugin Support Stuart Duff – a11n

    (@stuartduff)

    Automattic Happiness Engineer

    Hi @cinakh10,

    The only way to display a price range on a WooCommerce product page using the default features of the free WooCommerce plugin would be by configuring a Variable Product.

    https://docs.woocommerce.com/document/variable-product/

    Well, aside from what my colleagues mentioned what you want requires just a bit of coding.

    As I mentioned before, use the site as a catalog with a script, I’ll provide later. Create “simple” products and then use a custom field to display the price range.

    If the user is calling you can add a button there with the phone number as well.

    That’ll get you where your want to be. Again, look for a developer that can help you with this. There is a url on the main page of this support forum for that.

    Thread Starter cinakh10

    (@cinakh10)

    Yes, the best solution is to define a simple product with a price range. Because there is no shopping cart and only the price range is displayed to the customer. It may be easy to implement with a few simple codes or even a plugin, but unfortunately I can’t find it.

    Sorry, it’s been super crazy here today.

    I can tell you right now there is no plugin that can do what you want. But you can get very close with YITH’s catalog plugin.

    To turn your single products into a catalog site more or less. Add this snippet to your functions.php file in a child theme.

    – Do not add this to your functions file in your parent theme.
    – Do not edit inside the WP Admin.
    – Always use an FTP interface to edit files.

    You can actually take all this code and paste it into a file and call to it from your function file as well. However, you need to make sure you’re not calling the same instance.

    Best of luck!

    
    //removes the add to cart button
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' );
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
    
    //removes add to cart from categories
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
    add_action('wp', 'shop_remove_add_to_cart_product_categories' );
     
    function shop_remove_add_to_cart_product_categories(){
    	if( is_product_category( ) ) {
    		remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart');
    	}
    }
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart');
    
    //Only add this if you want to hide the price from people not logged in.
    add_action( 'init', 'shop_hide_price_add_cart_not_logged_in' );
     
    function shop_hide_price_add_cart_not_logged_in() {
    if ( !is_user_logged_in() ) {
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
    remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
    }
    }
    
    //This will open a form that you can create using Contact Form 7
    add_action( 'woocommerce_single_product_summary', 'shop_woocommerce_cf7_single_product', 30 );
     
    function shop_woocommerce_cf7_single_product() {
    echo '<button type="submit" id="trigger_cf" class="single_add_to_cart_button button alt">Inquire About</button>';//If you change this title change it below
    echo '<div id="product_inq" style="display:none">';
    echo do_shortcode('[contact-form-7 id="150" title="Product Inquiry Form"]');
    echo '</div>';
    }
     
    
     
    add_action( 'woocommerce_single_product_summary', 'shop_on_click_show_cf7_and_populate', 40 );
     
    function shop_on_click_show_cf7_and_populate() {
       
      ?>
        <script type="text/javascript">
            jQuery('#trigger_cf').on('click', function(){
          if ( jQuery(this).text() == 'Inquire About' ) {  //If you change this title change it above
                       jQuery('#product_inq').css("display","block");
                       jQuery('input[name="your-subject"]').val('<?php the_title(); ?>');
             jQuery("#trigger_cf").html('Close'); 
          } else {
             jQuery('#product_inq').hide();
             jQuery("#trigger_cf").html('Inquire About'); //If you change this title change it above
          }
            });
        </script>
       <?php
          
    }
    
    

    Tested in Storefront and 2 other themes. It works.

    • This reply was modified 5 years, 11 months ago by Stef.

    P.S. I forgot to mention @cinakh10 that if you can’t get this to work. Please don’t reply back here. Hire a developer to get it to work.

    This support forum is strictly for WooCommerce natively, not to customize it.

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Price range’ is closed to new replies.