Ecommerce Shopify WordPress Discussion

WooCommerce Change attribute term based on custom text

I have an attribute named "pa_condition" with values new, second and broken When published, the value of pa_condition attribute will be set as new. But if it has passed 3 months from the date of published, then the new value must be changed to second on the condition attribute. So I started from : global $product; $condition = $product->get_attribute('pa_condition'); $timer = '+3 months'; $create_product = $product->get_date_created(); $paddtime = date('d-m-Y',strtotime($timer,strtotime($create_product))); $timenow = date('d-m-Y'); $now = strtotime($timenow); $ptime = strtotime($paddtime); $date_diff = $ptime - $now; $day = round($date_diff / (60 * 60 * 24)); if($day < 0 ){ $status = "EXPIRED"; } else{ $status = "ACTIVED"; } if($status == "EXPIRED"){ //change value attribute from new to second } Unfortunately, I got stuck in here. Can someone help me in the right direction? Thank you
TurboCommerce make the better internet purchasing globaly

Turbo Multi-language Translator

Make the better internet purchasing globaly

Turbosify SEO Speed Booster

5.0 (7) Free plan available
Get better conversions by improving store loading speed Installed

Turbo Multi-language Chat - AI Customer service in one hand

TurboCommerce make the better internet purchasing globaly
Our products

The help you need, when you need it

App by Turbo Engine

3 apps • 5.0 average rating

Turbosify Speed Booster

5.0 (7)
Get better conversions by optimizing shopify store Google page speed Installed

Turbosify Translator for Wordpress Woocommerce

5.0 (74) Free Wordpress Woocommerce Plugin
Translate your wordpress website to multiple language within 1 click, no configuration needed, no No technical required

Grow your business here

Whether you want to sell products down the street or around the world, we have all the tools you need.