Repository › Forums › Support › Expiry dates for WooCommerce PRO › Hiding Expiry dates to customer cart but Not to admin
- This topic has 10 replies, 3 voices, and was last updated 4 years, 2 months ago by Soft79.
-
AuthorPosts
-
September 25, 2018 at 4:23 pm #3831wanParticipant
Hi, I have just purchased expiry dates pro and wonder how if i would like to hide the expiry date from cart page or basically hide it from customer ?
This expiry date would be useful for us to manage fifo of stock but to consumer it will make things more complicated.
If i can hide it to them in cart page, packing list etc or have option to do this would be great.September 25, 2018 at 4:47 pm #3832Soft79KeymasterYou can disable this on the page wp-admin > Products > Expiry Dates. It can be set for every individual type of expiry (e.g. Best before or Expiry date).
September 27, 2018 at 1:23 pm #3845wanParticipantHi, I am able to hide it now in cart page for consumers but;
I notice on orders there is still info on expiry which is good but if i can hide this on packing list is better so we just remain the record on our back end.
having listed expiry date on packing list or invoice will trigger much deeper issue when a little mistake on picking the orders happen.This plugin is very good to remind date of expiry will be pleased if customer also do not see the date in their order email.
February 20, 2019 at 9:16 am #4895aurelien.arthapignetParticipantHi,
We have the same issue, we disable display of expiry date but we still have it on customer email.
I’ve tried this, but no luck:
add_filter( ‘woocommerce_order_item_get_formatted_meta_data’, ‘unset_specific_order_item_meta_data’, 10, 2);
function unset_specific_order_item_meta_data($formatted_meta, $item){
// Only on emails notifications
if( is_admin() || is_wc_endpoint_url() )
return $formatted_meta;foreach( $formatted_meta as $key => $meta ){
if( in_array( $meta->key, array(‘_wcxd_expiry_date’) ) )
unset($formatted_meta[$key]);
}
return $formatted_meta;
}Can you help?
Thanks.
February 20, 2019 at 9:37 am #4896Soft79KeymasterYes, there is some work to do on the order meta handling.
For now, try replacing the following line in your snippet:
add_filter( ‘woocommerce_order_item_get_formatted_meta_data’, ‘unset_specific_order_item_meta_data’, 10, 2);
by:
add_filter( ‘woocommerce_order_item_get_formatted_meta_data’, ‘unset_specific_order_item_meta_data’, 20, 2);
February 23, 2019 at 8:14 am #4904aurelien.arthapignetParticipantThank you it worked however wcxd_expiry_date suddenly popped up on clients emails, here is the full code to hide both expiry and wcxd:
add_filter( ‘woocommerce_order_item_get_formatted_meta_data’, ‘unset_specific_order_item_meta_data’, 20, 2);
function unset_specific_order_item_meta_data($formatted_meta, $item){
// Only on emails notifications
if( is_admin()/* || is_wc_endpoint_url() */)
return $formatted_meta;foreach( $formatted_meta as $key => $meta ){
if( in_array( $meta->key, array(‘wcxd_expiry_date’,’_wcxd_expiry_date’) ) )
unset($formatted_meta[$key]);
}
return $formatted_meta;
}February 23, 2019 at 3:25 pm #4908Soft79KeymasterDevelopment version 1.3.0-dev.6 is available from your account page. This version respects the ‘display expiry date on order confirmation’-setting. You no longer need the PHP scripts mentioned above.
Please let me know if there still are issues with this version.
March 7, 2019 at 9:22 pm #4953aurelien.arthapignetParticipantHi
Can’t find the dev version on my account.
We got new issue: the script doesn’t work on some emails. And for the ones that doesn’t work, the meta shown right now are 2, instead of 1, both showing the same value. E.g.:
wcxd_expiry_date: May 15, 2019
Expiry Date: May 15, 2019Here’s the function we’re using right now:
add_filter( ‘woocommerce_order_item_get_formatted_meta_data’, ‘unset_specific_order_item_meta_data’, 20, 2);
function unset_specific_order_item_meta_data($formatted_meta, $item){
// Only on emails notifications
if( is_admin() )
return $formatted_meta;foreach( $formatted_meta as $key => $meta ){
if( in_array( $meta->key, array(‘wcxd_expiry_date’,’_wcxd_expiry_date’) ) )
unset($formatted_meta[$key]);
}
return $formatted_meta;
}March 7, 2019 at 9:39 pm #4954Soft79KeymasterWhat is the order number of your purchase? I can’t find your license.
March 7, 2019 at 9:45 pm #4955aurelien.arthapignetParticipantHere is the license for expiry dates : ****-********-********-********
March 7, 2019 at 9:46 pm #4956Soft79KeymasterThe payment of that order was unsuccesful. It has never been paid.
-
AuthorPosts
- You must be logged in to reply to this topic.