0

I am working on a website in which I need to disable the Add to cart "Book Now" button after a certain date (Event date) based on the timezone shortcode that I created and also want to relabel it as "Event Ended"

You guys can check the event page.

https://innercamp.com/product/cacao-breathwork/

So can someone help me out on this one because I am not very familiar with the WordPress code?

I want a logic based on the event time shortcode that I created : [product_custom_field field_name="start_date" format_value="true"]

The thing is I have created a template in elementor library and using it on many products page via advanced custom fields for the dynamic values and every event will start on a different date so I don't want my customers to book the event after the release date because it will not make any sense because that product is already live.

  • Manipulating such core features as the add to cart button, should be done using the appropriate hooks. Only in those, you will likely not have access to any attributes from a shortcode, that executes in a totally different context. But if this is stored as product meta data, you don't need any shortcode, you should be able to read the value inside the hook callback function directly then. – CBroe Jun 15 '22 at 08:21
  • @CBroe So any options or code that will help me on this because I am not that good in coding. – Avinish Kr. Singh Rajawat Jun 15 '22 at 08:53
  • 1
    You can start by looking at https://stackoverflow.com/a/68670388/1427878 or https://stackoverflow.com/q/65821872/1427878 But you will have to dive a little deeper into this yourself, this site is not a code writing or research service. "Not good in coding" might sometimes also simply mean, that you will need to hire someone to implement something like this for you then. – CBroe Jun 15 '22 at 08:56
  • Why not just make the product out of stock at specific date ? That way ppl wont be able to purchase it but can look it. Best way is to have custom field in your product to set your date. Then create a cron to run and update stock meta of the product if needed. You can find all of those pieces of code in this forum - https://stackoverflow.com/questions/51940338/updating-product-stock-programmatically-in-woocommerce-3 https://stackoverflow.com/questions/49954871/setting-up-a-cron-job-corectly-within-wordpress-plugin – Snuffy Jun 15 '22 at 10:16

0 Answers0