• Resolved lordman101

    (@lordman101)


    i am working on headless application using woocommerce rest api. i need a functionality to hide add to cart button for certain period of time. i know its possible to use woocommerce filter to disable add to cart with the help custom plugin but I need it in headless application. this filter disable the whole shop and i need exactly like that.

    add_filter( 'woocommerce_is_purchasable', '__return_false');

    don’t know how can I achieve it using woocommerce rest api. i go through whole woocommerce api documentation only found catalog_visibility and set product status into Draft. but its not an ideal solution. so any help really save my lot of time Thanks.

    • This topic was modified 2 years, 10 months ago by lordman101. Reason: add tags
    • This topic was modified 2 years, 10 months ago by lordman101.
Viewing 12 replies - 1 through 12 (of 12 total)
  • Hello there,

    You can do it using custom code as explained in this post.

    Could you please let us know the reason to disable add to cart for a certain period of time? That will help us to understand your requirement much better, thanks.

    Thread Starter lordman101

    (@lordman101)

    Thank you for your reply, I am developing an order-taking application for kitchen display. where I take orders in real-time so sometimes if there is some problem in the kitchen I need to stop taking orders and disable add to cart button for like 10 min 20 min and so on. like uber eat app have the option to pause orders. https://www.youtube.com/watch?v=LX01jbsYH7s

    Hello,

    Thank you for the clarification, that definitely makes sense.

    This article is closer to what you would like to achieve, please check it.

    I hope this leads you in the right direction ??

    Thread Starter lordman101

    (@lordman101)

    Action hooks are not available in woocommerce rest api. i am developing a headless application. just want someone guide me in the right direction because in woocommerce rest api documentation there is no way to add these hooks or use action hook and filters.

    Thread Starter lordman101

    (@lordman101)

    is there any way to use hooks in headless application

    Hello there,
    This does not seem like something we are going to be able to help with as it’s too advanced for what we can support at WooCommerce.

    I’ll leave the topic open, maybe a developer can help you here!

    Thread Starter lordman101

    (@lordman101)

    @augustuswp Thanks, yes sure I am looking forward

    Hey @lordman101,

    Have you considered adding a way to disable this in the app instead? Add an option in the dashboard that can then disable the add to cart ability within the app itself. That would prevent customers from ordering via the app when that mode is active without needing to change the REST API. Just a thought.

    Thread Starter lordman101

    (@lordman101)

    Hi, the app hasn’t been developed yet. it’s a web application dashboard and like a control panel. choosing a path with the headless application have some limitation. now I am working on different possibilities and testing them.

    Mirko P.

    (@rainfallnixfig)

    Hi @lordman101,

    That sounds good! If you want to get some more inputs from developers I’d recommend also asking in the following channels.

    * WooCommerce Slack Community: https://woocommerce.com/community-slack/
    * WooCommerce Community on Facebook: https://www.facebook.com/groups/advanced.woocommerce/

    These are channels where many developers hang out and they’re best placed to help you with this.

    Cheers.

    Thread Starter lordman101

    (@lordman101)

    Thanks, @rainfallnixfig will check for sure

    Mirko P.

    (@rainfallnixfig)

    Hi there,

    We’ve not seen any activity on this thread for a while, so I’m marking this thread as resolved.

    Hopefully, you were able to find a solution and the above resources for developers were helpful. If you have further questions, please feel free to open a new topic.

    Thanks.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Hide add to cart using woocommerce rest api in headless application’ is closed to new replies.