Support » Plugin: WooCommerce » How to Have Variable Products Only Show Valid Combinations

  • Resolved pmbrenner91

    (@pmbrenner91)


    Good morning!

    I have a variable product created on my website:

    Flags

    What I’d like is for certain options to become unavailable depending on the previous selected option.

    So, selecting a “Pole Flag” item type will eliminated non-pole flag sizes under the size option.

    If the customer isn’t paying attention and selects a feather flag size for a teardrop flag, an error is displayed: “Sorry, no products matched your selection. Please choose a different combination.”

    I’d like to avoid that error by forcibly removing the options that would allow a customer to arrive at this error.

    Does that make sense?

    ### WordPress Environment ###
    
    Home URL: http://store.edj.ink
    Site URL: http://store.edj.ink
    WC Version: 2.5.2
    Log Directory Writable: ✔  /home/pmbrenner91/public_html/store/wp-content/uploads/wc-logs/
    WP Version: 4.4.2
    WP Multisite: –
    WP Memory Limit: 256 MB
    WP Debug Mode: –
    Language: en_US
    
    ### Server Environment ###
    
    Server Info: Apache/2.4.16
    PHP Version: 5.4.45
    PHP Post Max Size: 48 MB
    PHP Time Limit: 120
    PHP Max Input Vars: 1000
    SUHOSIN Installed: –
    MySQL Version: 5.5.45
    Max Upload Size: 32 MB
    Default Timezone is UTC: ✔
    fsockopen/cURL: ✔
    SoapClient: ✔
    DOMDocument: ✔
    GZip: ✔
    Multibyte String: ✔
    Remote Post: ✔
    Remote Get: ✔
    
    ### Database ###
    
    WC Database Version: 2.5.2
    :
    woocommerce_sessions: ✔
    woocommerce_api_keys: ✔
    woocommerce_attribute_taxonomies: ✔
    woocommerce_termmeta: ✔
    woocommerce_downloadable_product_permissions: ✔
    woocommerce_order_items: ✔
    woocommerce_order_itemmeta: ✔
    woocommerce_tax_rates: ✔
    woocommerce_tax_rate_locations: ✔
    
    ### Active Plugins (10) ###
    
    Code Snippets: by Shea Bunge – 2.6.1
    Google Analytics by Yoast: by Team Yoast – 5.4.6
    Limit Login Attempts: by Johan Eenfeldt – 1.7.1
    Simple Custom CSS: by John Regan
    Danny Van Kooten – 3.3
    
    SiteOrigin Widgets Bundle: by SiteOrigin – 1.5.7
    WooCommerce Product CSV Import Suite: by WooThemes – 1.10.7 – 1.10.8 is available
    WooCommerce: by WooThemes – 2.5.2
    WooThemes Helper: by WooThemes – 1.5.9
    Yoast SEO: by Team Yoast – 3.0.7
    Clef: by Clef – 2.3.4
    
    ### Settings ###
    
    Force SSL: –
    Currency: USD ($)
    Currency Position: left
    Thousand Separator: ,
    Decimal Separator: .
    Number of Decimals: 2
    
    ### API ###
    
    API Enabled: ✔
    API Version: 3.1.0
    
    ### WC Pages ###
    
    Shop Base: #5 - /
    Cart: #6 - /cart/
    Checkout: #7 - /checkout/
    My Account: #8 - /my-account/
    
    ### Taxonomies ###
    
    Product Types: external (external)
    grouped (grouped)
    simple (simple)
    variable (variable)
    
    ### Theme ###
    
    Name: Sydney Pro
    Version: 1.31
    Author URL: http://athemes.com
    Child Theme: ✕ – If you're modifying WooCommerce on a parent theme you didn't build personally
    then we recommend using a child theme. See: How to create a child theme
    
    WooCommerce Support: ✔
    
    ### Templates ###
    
    Overrides: sydney-pro-ii/woocommerce/single-product/add-to-cart/external.php
    sydney-pro-ii/woocommerce/single-product/add-to-cart/grouped.php
    sydney-pro-ii/woocommerce/single-product/add-to-cart/simple.php
    sydney-pro-ii/woocommerce/single-product/add-to-cart/variable.php version 2.4.0 is out of date. The core version is 2.5.0
    
    : Learn how to update outdated templates

    https://wordpress.org/plugins/woocommerce/

Viewing 12 replies - 1 through 12 (of 12 total)
  • This looks similar to a question Mr Jolley answered a little while ago.

    Have a look at this:

    https://en-gb.wordpress.org/plugins/woocommerce-product-dependencies/

    His answer, not mine!

    Hey!

    Thanks a bunch for the prompt response! It’s not a product dependency, as in this product is not dependent on any other product. This product’s options is dependent on options of the same product. Will this plugin still help?

    Thanks!

    –Pat

    Plugin Author Mike Jolley

    (@mikejolley)

    THANK YOU MIKE!

    Works perfect.

    –Pat

    Hey there,

    I do not understand the Answer Mike gave. It has only to do with how to handle 20 variations but not with how to trigger an event to reload only valid combinations.

    Or do I get something wrong?

    Is there a solution for this problem?

    Thanks in Advance,

    Sergej

    Hi everybody, same problem here, any news?

    • This reply was modified 1 year, 5 months ago by  kove.

    hi there,

    I do have same issue…
    I do literally need the elimination of non possible options and I do have nearly 500 variations(with 5 different options).
    Unfortunately link to snippet posted by @mikejolley is no longer working…
    Any chance it can be posted directly here?

    thanks
    Regards
    Jan

    <?php
    add_filter( 'woocommerce_ajax_variation_threshold', 'custom_threshold', 40 );
    function custom_threshold( ) {
      return 500;
    }
    

    Beware if the threshold is too big, page size will increase to the point where performance may suffer, particularly for users on slow connections.

    @lorro

    Works perfect…
    thanks a lot for this

    I have to say that it still loads reasonably fast…
    …I nearly did not noticed difference and I do have truly 497 variations

    I guess if each of them has special picture or lots of details, then it may slow it down considerably

    I think any problem will be for mobile users who live in parts of the country not reached by 4G. In the UK, cities are well covered but coverage in some rural areas is patchy. Depends on the typical customer for your store.

    again, can someone detail the complete approach when using the snippet? How does the snippet help? Where does one set the dependencies?

    Make a child theme:
    https://codex.wordpress.org/Child_Themes
    This is to make your customisations update-safe.

    Put the snippet in functions.php in the root of child theme. The first line in functions.php must be <?php.

    Where the number of variations is greater than the default 20 threshold, WooCommerce will not load the variations with the page, This is to limit the data sent with the page, and this limits page load time. After the page has loaded, the customer will make a selection(s). An Ajax call is used to fetch the variation data. Sometimes the variation is unavailable, and the customer will get an annoying “This variation is unavailable” message.

    If the snippet is used to raise the threshold above the number of variations, all variation data is loaded with the page and the customer cannot select variations which are not available. The downside is page load time may increase, particularly for users on poor connections. The webmaster will have to make a judgement.

    There are no dependencies.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘How to Have Variable Products Only Show Valid Combinations’ is closed to new replies.