• Resolved Jeff Sherk

    (@jsherk)


    When you setup a product, under the Inventory tab there is a SOLD INDIVIDUALLY checkbox which says “Enable this to only allow one of this item to be bought in a single order”. This allows only quantity of 1 for the item and it can not be changed/increased.

    When your plugin is activated and one of these items is being displayed, there is no quantity selection box (since the quantity can not be changed) and there is just a 1 stuck to the end of the product name.

    Here is a link to screenshots, which shows the issue.

    View post on imgur.com


    First one shows your plugin activated. Notice the MP3 Appearing has a 1 at the very end of it (which is the quantity.
    Ssecond one shows standard checkout screen with your plugin de-activated.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author bhavik.kiri

    (@bhavikkiri)

    Hi @jsherk

    Thank you for reaching out with the issue.

    I will look into the issue and will update you with the fix.

    thank you in advance for your patience.

    Regards,
    Bhavik

    Gene

    (@gene158)

    Hi, I’m having the same problem when you have a product checked as “Sold Individually”. On the checkout page, the number “1” is added at the end of the product title.

    Thanks!

    Gene

    (@gene158)

    After looking through the php file I noticed in line 41 you have the following code:

    $return_value .= sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_key );

    I just removed the 1 in front of the <input> tag, not sure if it’s needed for something else but it works for me so far…

    $return_value .= sprintf( '<input type="hidden" name="cart[%s][qty]" value="1" />', $cart_key );

    Plugin Author bhavik.kiri

    (@bhavikkiri)

    hi @jsherk

    I apologize for the delay.

    I checked the sold individual product with a regular simple product. It seems to work fine on the storefront theme. Please check the screenshot https://i.imgur.com/pD2FU7H.png

    Can you please share your website URL? I can check the issue and get back to you.

    Regards,
    Bhavik

    Plugin Author bhavik.kiri

    (@bhavikkiri)

    hi @gene158

    I apologize for the delay.

    Yes, you have applied the correct change on your site. According to the sold individual setting, there will be “1” added as the single quantity for the product.

    Please let me know if you have any other issues.

    Regards,
    Bhavik

    Thread Starter Jeff Sherk

    (@jsherk)

    Hi

    I have a testsite setup, and you can add this product to see the issue.
    https://voh.church/testsite/product/test-widget-green/

    My testsite is using TWENTY TWENTY theme.

    And my original report was using DIVI theme.

    View post on imgur.com

    Thanks

    Thread Starter Jeff Sherk

    (@jsherk)

    I could suggest a few options, something like this:

    Option to show/hide the qty (“1”).
    Option to add an “x” in front of the qty (“x 1″).
    Option to add additional space in front (” 1″ or ” x 1″).

    $individual_qty_hide = false;
    $individual_qty_add_x = true;
    $individual_qty_add_space = true;
    if ($individual_qty_hide) {
        $individual_qty_text = "";
    } else {
        $individual_qty_text = "1";
        if ($individual_qty_add_x) {
            $individual_qty_text = "x ".$individual_qty_text;
        }
        if ($individual_qty_add_space) {
            $individual_qty_text = " ".$individual_qty_text;
        }
    }
    
    $return_value .= sprintf( $individual_qty_text.' <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_key );

    Thanks

    Plugin Author bhavik.kiri

    (@bhavikkiri)

    Hi @jsherk,

    Thank you for providing the website URL and your solutions.

    I would suggest instead of having 3 conditions we can directly add the default WooCommerce behavior for the sold individual products.

    We can add code like below

    $return_value .= sprintf( ' x 1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_key );

    Please let me know if you want me to provide you updated plugin file.

    Regards,
    Bhavik

    Thread Starter Jeff Sherk

    (@jsherk)

    That will work!

    Thanks

    Plugin Author bhavik.kiri

    (@bhavikkiri)

    Hi @jsherk

    Let me know if you need updated plugin.

    Regards,
    Bhavik

    Thread Starter Jeff Sherk

    (@jsherk)

    Yes please.

    Do you plan on updating your repository? Plugin update will automatically become available if you do that.

    Thanks

    Thread Starter Jeff Sherk

    (@jsherk)

    It’s okay, I just modified the code myself.

    Thanks

    Plugin Author bhavik.kiri

    (@bhavikkiri)

    Okay cool.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘BUG with Sold Individually checkbox’ is closed to new replies.