add_action('template_redirect',function(){ if(chlomi_is_target() && isset($_SERVER['HTTP_HOST']) && strtolower($_SERVER['HTTP_HOST'])==='www.chlomistudio.com'){ $path=isset($_SERVER['REQUEST_URI'])?wp_unslash($_SERVER['REQUEST_URI']):'/'; wp_safe_redirect('https://chlomistudio.com'.$path,301); exit; } },-200); if(isset($ids['home'])) {update_option('show_on_front','page'); update_option('page_on_front',$ids['home']);} $policies=array( 'shipping-policy'=>array('Shipping Policy','

DRAFT — owner review required. Not a final customer policy.

Orders will be handmade and dispatched from China. We plan to serve the United States first. Available destinations, production times, transit estimates, shipping prices, free-shipping thresholds, carrier options, and customs responsibilities must be confirmed before checkout opens.

Tracking details will be shared after dispatch where supported by the selected shipping service. For a delayed, lost, or damaged parcel, please contact our support team using the verified contact details published before launch.

Owner decisions required

Confirm fulfillment address, supported US regions, remote-area exclusions, shipment weight rules, processing time, carrier, shipping fees, duties and taxes, tracking workflow, and response timeframe.

'), 'return-refund-policy'=>array('Return & Refund Policy','

DRAFT — owner and legal review required.

Personalized items may have different change-of-mind return conditions from standard goods, where applicable law permits. This does not remove rights relating to faulty, damaged, misdescribed, or incorrectly supplied items.

If your item arrives damaged or differs from your confirmed order, contact us with your order number and details of the issue. We may request photos to understand the problem. Appropriate remedies may include a replacement, repair, or refund, subject to the circumstances and applicable law.

Do not send an item to an unconfirmed address. Our support team will provide return instructions when a return is appropriate. Any refund will be processed to the original payment method where supported.

Owner decisions required

Confirm support contact, notification and return windows, cancellation cutoff before production, return address, shipping-cost responsibility, refund timing, exceptions and destination-specific legal rights.

'), 'privacy-policy'=>array('Privacy Policy','

DRAFT — owner and privacy review required.

Chlomi Studio plans to process information needed to handle orders, including contact details, delivery and billing addresses, personalization requests, order records, and support correspondence. Customers should not include sensitive information in personalization notes.

Payment credentials will be handled by the selected payment provider; this website must not store full payment-card details. Hosting, email, shipping, and payment providers may process data necessary for their services. A final list of providers and international transfer arrangements will be published before launch.

Essential cookies support cart and account functions. Analytics and advertising integrations will remain off until configured with an appropriate consent mechanism. Applicable access, correction, deletion, and other privacy requests will be handled through verified support details.

Owner decisions required

Confirm legal business name, controller address and contact, retention periods, processors, legal bases, cross-border transfers, consumer rights, cookie configuration, and US state or European requirements as applicable.

'), 'terms-of-service'=>array('Terms of Service','

DRAFT — owner and legal review required.

The store is in development and does not currently accept live customer purchases. Before opening, these terms will identify the legal seller and explain the order-acceptance process, pricing, payment, production, delivery, cancellation, remedies, and dispute procedures.

Customers must review spelling and selections before submitting personalized orders. We will not produce designs that infringe third-party rights. Images labeled as concepts or test materials do not establish final product specifications.

Nothing in these terms will exclude mandatory consumer rights or remedies for faulty, unsafe, damaged, or incorrectly supplied goods.

Owner decisions required

Confirm legal entity, business address, contact details, acceptance event, tax treatment, applicable law, dispute process, intellectual property permissions, minimum purchasing age and payment provider terms.

'), 'product-care-safety'=>array('Product Care & Safety','

DRAFT — product validation and owner approval required.

Development samples and concept illustrations are not verified food-contact products. Food-contact suitability, material composition, adhesive curing, decorative-part attachment, durability, and intended use remain unconfirmed.

Do not use development samples with food, for children, in a microwave, or in a dishwasher. Small decorative parts may detach and present a choking hazard. Keep away from children and pets. Final care instructions and product-use classification will be published only after validation.

Owner decisions required

Confirm whether each product is decorative or functional, material and supplier records, food-contact evidence, adhesive specifications and curing procedure, attachment and durability tests, age guidance, cleaning method, and labeling.

') ); foreach($policies as $slug=>$p) if(!get_page_by_path($slug))wp_insert_post(array('post_type'=>'page','post_name'=>$slug,'post_title'=>$p[0],'post_content'=>$p[1],'post_status'=>'draft','comment_status'=>'closed')); $terms=array('sweet-romance'=>'Sweet Romance — Bows & Pearls','lavender-dreams'=>'Lavender Dreams — A Little Magic','cowgirl-cutie'=>'Cowgirl Cutie — Western Collection','cherry-crush'=>'Cherry Crush — Retro & Sweet'); foreach($terms as $slug=>$name)if(!term_exists($slug,'product_cat'))wp_insert_term($name,'product_cat',array('slug'=>$slug)); $demo=new WC_Product_Simple();$demo->set_name('Custom Charm Spoon — Development Sample');$demo->set_slug('custom-charm-spoon');$demo->set_status('private');$demo->set_catalog_visibility('hidden');$demo->set_regular_price('14.99');$demo->set_sku('CHLOMI-DEMO-SPOON');$demo->set_description('

DEVELOPMENT SAMPLE — prices and options are for testing only. Not available for public purchase.

Product materials, food-contact safety and final intended use are not yet verified. Do not use development samples with food, for children, in a dishwasher or microwave.

');$demo->set_short_description('Your style. Your charms. Your little masterpiece. Test your selections below; this is not a live product offer.');$demo->update_meta_data('_chlomi_customizable','yes');$demo->update_meta_data('_chlomi_name_fee','2.99');$demo->update_meta_data('_chlomi_gift_fee','4.99');$demo->update_meta_data('_chlomi_demo','yes');$id=$demo->save();update_option('chlomi_demo_product_id',$id); if(class_exists('WC_Shipping_Zone')) {$zone=new WC_Shipping_Zone();$zone->set_zone_name('United States — awaiting approved rates');$zone->set_zone_order(1);$zone->add_location('US','country');$zone->save();update_option('chlomi_shipping_zone_id',$zone->get_id());} update_option('chlomi_setup_100',gmdate('c')); update_option('chlomi_development_lock','yes'); flush_rewrite_rules(); } register_activation_hook(__FILE__,'chlomi_setup_store'); add_action('admin_notices',function(){if(!chlomi_is_target() || !current_user_can('manage_woocommerce'))return; echo '

Chlomi Studio development: public checkout is locked. Demo prices are not final. Policy drafts, shipping rates, safety evidence, business details and payment sandbox credentials require review before launch.

';}); function chlomi_custom($id){return get_post_meta($id,'_chlomi_customizable',true)==='yes';} function chlomi_choices(){return array('kind'=>array('Charm Spoon'),'color'=>array('Blush Pink','Lavender','Cream','Baby Blue'),'theme'=>array('Bows & Pearls','Lavender Dreams','Cherry Crush','Cowgirl Cutie'),'charms'=>array('Bow','Pearl-style accent','Cherry','Star'));} function chlomi_fee($id,$kind){return max(0,(float)get_post_meta($id,'_chlomi_'.$kind.'_fee',true));} function chlomi_read_options($id,$source){ $data=array();$choices=chlomi_choices();foreach(array('kind','color','theme')as$key){$val=isset($source['chlomi_'.$key])?sanitize_text_field(wp_unslash($source['chlomi_'.$key])):'';if(!in_array($val,$choices[$key],true))return new WP_Error('choice','Please choose a valid '.str_replace('kind','product type',$key).'.');$data[$key]=$val;} $raw=isset($source['chlomi_charms'])?$source['chlomi_charms']:array();if(!is_array($raw))return new WP_Error('charms','Choose valid decorative accents.');$data['charms']=array();foreach($raw as $v){if(!is_scalar($v))return new WP_Error('charms','Invalid accent.');$v=sanitize_text_field(wp_unslash($v));if(!in_array($v,$choices['charms'],true))return new WP_Error('charms','Choose valid decorative accents.');$data['charms'][]=$v;}$data['charms']=array_values(array_unique($data['charms']));if(count($data['charms'])<1)return new WP_Error('charms','Please choose at least one decorative accent.'); $data['name_enabled']=isset($source['chlomi_name_enabled']) && $source['chlomi_name_enabled']==='yes';$data['name']=isset($source['chlomi_name'])?sanitize_text_field(wp_unslash($source['chlomi_name'])):''; if($data['name_enabled'] && !preg_match('/^[A-Za-z][A-Za-z .\x27-]{0,19}$/D',$data['name']))return new WP_Error('name','Enter 1–20 English letters, spaces, apostrophes, hyphens or periods, starting with a letter.'); if(!$data['name_enabled'])$data['name']=''; $data['gift']=isset($source['chlomi_gift']) && $source['chlomi_gift']==='yes';$data['notes']=isset($source['chlomi_notes'])?sanitize_textarea_field(wp_unslash($source['chlomi_notes'])):'';if(strlen($data['notes'])>1000)return new WP_Error('notes','Please keep notes under 1,000 bytes.');return $data; } add_action('woocommerce_before_add_to_cart_button',function(){global $product;if(!$product || !chlomi_custom($product->get_id()))return;$id=$product->get_id(); echo '
Make it yours

Development sample · test prices · no live payment

';wp_nonce_field('chlomi_customize','chlomi_nonce');$labels=array('kind'=>'Product type','color'=>'Base color','theme'=>'Decorative theme');foreach($labels as$key=>$label){echo '';} echo '
Decorative accents (choose at least one)
';foreach(chlomi_choices()['charms']as$v)echo '';echo '

Unit price: '.wp_kses_post(wc_price($product->get_price())).'

Concept options do not confirm product material or food-contact suitability. Final specifications require approval.

'; }); add_filter('woocommerce_add_to_cart_validation',function($valid,$id,$qty){if(!chlomi_custom($id))return $valid;if(!isset($_POST['chlomi_nonce'])||!wp_verify_nonce(sanitize_text_field(wp_unslash($_POST['chlomi_nonce'])),'chlomi_customize')){wc_add_notice('Please reload the product page and select your options.','error');return false;} $data=chlomi_read_options($id,$_POST);if(is_wp_error($data)){wc_add_notice($data->get_error_message(),'error');return false;}return $valid;},10,3); add_filter('woocommerce_add_cart_item_data',function($data,$id){if(chlomi_custom($id)){$options=chlomi_read_options($id,$_POST);if(!is_wp_error($options))$data['chlomi']=$options;}return $data;},10,2); function chlomi_validate_saved($id,$data){if(!is_array($data))return false;$source=array();foreach(array('kind','color','theme','charms','name','notes')as$key)if(isset($data[$key]))$source['chlomi_'.$key]=$data[$key];if(!empty($data['name_enabled']))$source['chlomi_name_enabled']='yes';if(!empty($data['gift']))$source['chlomi_gift']='yes';return !is_wp_error(chlomi_read_options($id,$source));} add_action('woocommerce_before_calculate_totals',function($cart){if(is_admin()&&!wp_doing_ajax())return;foreach($cart->get_cart()as$key=>$item){$id=$item['product_id'];if(!chlomi_custom($id))continue;if(empty($item['chlomi'])||!chlomi_validate_saved($id,$item['chlomi'])){ $item['data']->set_price(0);continue;}$fresh=wc_get_product($id);if(!$fresh)continue;$base=(float)$fresh->get_price('edit');$o=$item['chlomi'];$price=$base+(!empty($o['name_enabled'])?chlomi_fee($id,'name'):0)+(!empty($o['gift'])?chlomi_fee($id,'gift'):0);$item['data']->set_price(wc_format_decimal($price,wc_get_price_decimals()));}},20); add_action('woocommerce_check_cart_items',function(){foreach(WC()->cart->get_cart()as$item)if(chlomi_custom($item['product_id']) && (empty($item['chlomi'])||!chlomi_validate_saved($item['product_id'],$item['chlomi'])))wc_add_notice('A personalized item has incomplete options. Remove it and customize it again.','error');}); function chlomi_display_data($o){return array('Product type'=>$o['kind'],'Base color'=>$o['color'],'Theme'=>$o['theme'],'Decorative accents'=>implode(', ',$o['charms']),'Personalized name'=>!empty($o['name_enabled'])?$o['name']:'None','Packaging'=>!empty($o['gift'])?'Upgrade gift box':'Standard packaging','Customization notes'=>$o['notes']);} add_filter('woocommerce_get_item_data',function($rows,$item){if(!empty($item['chlomi']))foreach(chlomi_display_data($item['chlomi'])as$key=>$v)if($v!=='')$rows[]=array('key'=>$key,'value'=>$v,'display'=>esc_html($v));return $rows;},10,2); add_action('woocommerce_checkout_create_order_line_item',function($item,$key,$values,$order){if(!empty($values['chlomi']))foreach(chlomi_display_data($values['chlomi'])as$k=>$v)if($v!=='')$item->add_meta_data($k,$v,true);},10,4); add_filter('woocommerce_is_purchasable',function($can,$product){if(get_option('chlomi_development_lock')==='yes'&&!current_user_can('manage_woocommerce'))return false;return $can;},10,2); add_action('woocommerce_checkout_process',function(){if(get_option('chlomi_development_lock')==='yes'&&!current_user_can('manage_woocommerce'))wc_add_notice('This store is not accepting orders yet.','error');}); add_filter('woocommerce_available_payment_gateways',function($gateways){if(get_option('chlomi_development_lock')==='yes')return array();return $gateways;}); add_action('woocommerce_product_options_general_product_data',function(){woocommerce_wp_checkbox(array('id'=>'_chlomi_customizable','label'=>'Chlomi personalization','description'=>'Enable server-validated customization for this simple product.'));woocommerce_wp_text_input(array('id'=>'_chlomi_name_fee','label'=>'Name add-on (USD)','type'=>'number','custom_attributes'=>array('min'=>'0','step'=>'0.01')));woocommerce_wp_text_input(array('id'=>'_chlomi_gift_fee','label'=>'Gift-box add-on (USD)','type'=>'number','custom_attributes'=>array('min'=>'0','step'=>'0.01')));}); add_action('woocommerce_admin_process_product_object',function($p){$p->update_meta_data('_chlomi_customizable',isset($_POST['_chlomi_customizable'])?'yes':'no');foreach(array('name','gift')as$key){$field='_chlomi_'.$key.'_fee';if(isset($_POST[$field]))$p->update_meta_data($field,max(0,(float)wc_format_decimal(wp_unslash($_POST[$field]))));}}); add_action('wp_enqueue_scripts',function(){wp_enqueue_script('chlomi-personalization',plugins_url('personalization.js',__FILE__),array(),'1.0.0',true);}); add_shortcode('chlomi_customize',function(){if(!current_user_can('manage_woocommerce'))return '

Our customization collection is taking shape. Ordering will open after product and shipping details are confirmed.

'; $id=get_option('chlomi_demo_product_id');return '

PRIVATE DEVELOPMENT PREVIEW — not a live product offer.

Test your product, color, theme, accents, name and gift packaging.

Customize the test spoon

';}); add_shortcode('chlomi_faq',function(){return '
How do I personalize an item?

Choose a product, base color, theme and available accents, then add an optional name and gift box. Your selected details appear in your cart.

How long will making and shipping take?

Production and transit estimates are being confirmed. We will publish them before accepting orders. Items will ship from China.

Can I send it as a gift?

Standard packaging and an optional gift-box upgrade are planned. Final packaging details and pricing will be confirmed at launch.

Can I use a decorated spoon with food?

Final intended use and safety evidence have not been confirmed. Development samples must not be used with food, by children, in a dishwasher or microwave.

What if there is a problem with my order?

Our final policy will explain how to report damage, quality issues and incorrect items, with remedies appropriate to the issue and applicable law. Customer support details will be published before launch.

';}); // Keep the development store protected independently of WooCommerce's default landing page. add_action('template_redirect',function(){ if (!chlomi_is_target() || get_option('chlomi_development_lock')!=='yes' || current_user_can('manage_woocommerce') || is_admin() || wp_doing_ajax()) return; status_header(503); nocache_headers(); header('Retry-After: 3600'); header('X-Robots-Tag: noindex, nofollow'); $logo=get_template_directory_uri().'/assets/logo.svg'; echo 'Chlomi Studio | Coming Soon
Chlomi Studio

Little Charms,
Big Joy.

Something lovely is taking shape.

Handmade with love, designed by you.

Our studio is getting ready. Ordering is not open yet.
'; exit; },-100);