• Resolved mago95

    (@mago95)


    Good afternoon!

    I was hoping you could help me a little bit with a use case I’m trying to accomplish.
    I’m trying to display a custom message next to the quantity selected by the user on the single product page.
    Let me explain with an example: let’s suppose one of the users of my website enters the product page for carrots.
    When the user selects 0.25 as quantity (my website supports decimal quantities), I would like to see next to the add to cart button (basically ‘woocommerce_after_add_to_cart_button’ hook) a message saying “250g (quantity * 100) of carrots (product name) is roughly 2 (int(quantity/default item weight)) carrots.”
    This message should automatically change if a user selects 0.5 as quantity (in which case it should show “500g of carrots is roughly 4 carrots”).
    Does anyone have any ideas on how I could achieve this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello @mago95!

    This is a fairly complex development topic (which is beyond the scope of this forum). I’m going to leave it open for a bit to see if anyone is able to chime in to help you out.

    For help with custom code we recommend the WooCommerce Developer Resources Portal.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack. We’re lucky to have a great community of open-source developers for WooCommerce, and many of our developers hang out there, as well.

    Lastly, for direct assistance with code customizations, we recommend consulting with the WooCommerce Customizations Partners. https://woocommerce.com/customizations/`

    Seems we’ve not had additional inputs on this thread. Thus, we encourage you to make use of the above resources.

    I’ll go ahead and mark the thread as resolved but please feel free to create a new thread if you have further questions.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Custom message next to product quantity’ is closed to new replies.