• Resolved mikmikmik

    (@mikmikmik)


    Hi Fahad,
    I’m trying to use the slw_product_variations_locations shortcode on product pages to just show inventory levels but it’s outputting every variation attribute separately instead of grouped sets of actual variations.

    For instance, I have a variable product with colour and size attributes. It’s outputting:

    Blue
    Location1 – 3
    Location2 – 4
    Location3 – 5+

    Small
    Location1 – 3
    Location2 – 4
    Location3 – 5+

    Red
    Location1 – 1
    Location2 – 8
    Location3 – 9+

    Medium
    Location1 – 1
    Location2 – 8
    Location3 – 9+

    What I think it should be doing is outputting the actual variations like so:

    Blue/Small
    Location1 – 3
    Location2 – 4
    Location3 – 5+

    Red/Medium
    Location1 – 1
    Location2 – 8
    Location3 – 9+

    Is there any way for the plugin to output like that?

    Thanks,
    Mik

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Fahad Mahmood

    (@fahadmahmood)

    @mikmikmik please try the latest version and late me know if it works for you?

    Thread Starter mikmikmik

    (@mikmikmik)

    Fantastic! thanks for the quick fix and update Fahad!

    Thread Starter mikmikmik

    (@mikmikmik)

    hmm actually not out of the woods, it seems whatever changes you’ve made have a bug and if the shortcode is placed above the code for the add to cart button on the product page the variation selections and add to cart button disappear!

    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    @mikmikmik I didn’t understand, so changing the shortcode position is creating some problem? See, keep the two things separate, each variation is appearing with its all attributes combination as a heading and location stock value under the heading. I have also made them collapsible. Now you are talking about the positioning and disappearance, right? Please explain your problem with a video recorded.

    Thread Starter mikmikmik

    (@mikmikmik)

    hi fahad, im not sure how to do a screen recording, but will try to explain.

    i’m using storefront theme and placing a shortcode in content-single-product.php template.

    if i place the code like this:
    echo do_shortcode(‘[slw_product_variations_locations show_qty=”yes” show_stock_status=”yes” show_empty_stock=”yes”]’);

    do_action( ‘woocommerce_single_product_summary’ );

    the entire add to cart form doesn’t appear in code or on the page.

    if i switch it so the shortcode runs after the product summary action then it renders.

    do_action( ‘woocommerce_single_product_summary’ );
    echo do_shortcode(‘[slw_product_variations_locations show_qty=”yes” show_stock_status=”yes” show_empty_stock=”yes”]’);

    am wondering if there’s an error in the shortcode that’s stopping the add to cart form from appearing.

    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    @mikmikmik actually this shortcode was initially provided for the text editors from where it gets the global $product etc. to proceed. Your implementation is different, maybe we pass the product id as an argument in this shortcode so that will fix the problem but I didn’t check it yet. For recording, there are some chrome browser based extensions available. You may use the urgent help option under the help tab on settings page. Your patience is appreciated, I will come back to this point again later.

    Thread Starter mikmikmik

    (@mikmikmik)

    hmm global $product; is part of this template above the code i’m inserting, so it should be able to access that.

    i’ve tried adding the shortcode directly in the product page editor and get the same issue. if i paste it into the “product short description” which appears above the add to cart button then it doesn’t render the add to cart button

    if i place the shortcode in the long description then it renders fine.

    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    Mik, see, it is not a bug actually. Earlier this shortcode was provided for normal users which can easily use it inside the text editors. If you are expecting it in the short description area so apply_filters/the_content would be required there. And same like that if you think global $post or $product is available in the product template page so it should work, I am not sure it ever it was tested like that. As you brought it to my attention, i will surely work on it. But please confirm that your initial query was about the correction of attributes to variation attributes combination instead, that has been fixed. I will update you later about your new requirements.

    Thread Starter mikmikmik

    (@mikmikmik)

    hi fahad, yep my initial quest was solved, sorry to conflate the two issues. it’s not in production yet so no need to act quickly on the bug. i’ll check out the plugins code myself and see if i can offer any insight into why it’s happening.
    thanks, mik

    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    @mikmikmik in the version 2.0.0, I have improved the shortcodes. Please try it as bad as you can so I can hammer it more.

    1. A new attribute is collapsed=”yes/no”
    2. Another attribute added as product_id=”numeric value” so either you use this shortcode on a product page or any other page/post. If you are in a PHP file so you can pass get_the_ID() or $post->ID or $product->get_id() or maybe a hardcoded value.
    3. If someone mistakenly used a variation shortcode on simple, still it will work and the other shortcode on variable product, still it will work ??
    4. Beware of collpased=”yes” in simple product type because there you won’t have variations as heading which can be clicked to see the locations and their stock values, so collapsed should remain “no” for simple products.
    5. I have tested in short description, additional description under tabs and in both editors and files. Everywhere shortcodes are working.
    Thread Starter mikmikmik

    (@mikmikmik)

    Hi Fahad,

    I’ve updated the plugin to 2.0 and unfortunately I’m still seeing the same issue. Placing the slw_product_variations_locations or slw_product_locations shortcodes, with or without the new parameters, above the add to cart form on a variable product seems to remove the <form class=”variations_form cart”> form completely from the page. They work fine on a simple product however.

    I’ve tried turning off plugins which might affect the display of that variations cart and nothing’s helping.

    cheers,
    mik

    Plugin Author Fahad Mahmood

    (@fahadmahmood)

    Dear Mik,

    Please do not open this thread because actually issue has been resolved. Your actual query was displaying the items in a specific format so that is implemented. What you are trying to achieve now, is a different query. Kindly use the urgent help option under the help tab on settings page so I can see the issue with you.

    Thread Starter mikmikmik

    (@mikmikmik)

    no worries, i just thought it was relevant seeing as the issue only appeared after version 1.9.5 when this feature was implemented. all good.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘slw_product_variations_locations shortcode’ is closed to new replies.