Reposition Release Date
-
Hi there,
Is there a way I can place the release date above the price and the add to cart button please?
Also is it possible to have the message font weight in bold but the release date normal like so:
Release Date: May 04, 2023
Thank you for your help!
- This topic was modified 1 year, 8 months ago by JapeNZ.
-
Unfortunately, there is not settings available for this. But you can do this by programmatically !!
add_action( 'woocommerce_single_product_summary', 'display_pre_order_notice', 7 ); function display_pre_order_notice() { $product = new \SpringDevs\PreOrder\Frontend\Product(); $product->put_product_txt(); }
Thanks.
Hi,
We’ve added Label position setting in v1.0.4
Thanks.
Hi @ok9xnirab,
Thank you for looking at this for me, and thank you for adding the setting!
The ‘After Product Title’ option doesn’t seem to work, it displays in the same place as the ‘Before Product Title’ option.
Also would it be possible to add ‘Inside Short Description’ as an option as well please?Thanks again for your help, amazing support!
- This reply was modified 1 year, 8 months ago by JapeNZ.
The ‘After Product Title’ option doesn’t seem to work, it displays in the same place as the ‘Before Product Title’ option.
Both options works fine in my case. Make sure your theme is fully compatible with WooCommerce.
Thanks.
HI @ok9xnirab,
Thank you for checking, I’ve tried switching themes and it looks like it is a limitation of my theme… sorry for not doublechecking before mentioning it ??
Is there a way to add the the release date to the ‘Inside Short Description’ area do you think?
I’ve tried playing around with it but can’t work out which hook I need to call on.Thanks again!
You need to set Label position to default . If you want to display release date after product’s short description.
If you want to mixed release date with short description. Then you need to filter the content of short description.
To access current product release date :
global $product; $rels_date = $product->get_meta( '_preorder_product_release_date', true );
Thanks.
Hi @ok9xnirab,
I’ve been playing around and I think the issue is my theme.
The CyberChimps Responsive theme allows you to move the placement of the various ‘woocommerce_single_product_summary’ sections via the ‘customize’ area… while this is great, I believe it creates a product summay block and therefore limits positioning to before or after the summary.This is the Single Product Structure option in my theme that I’m assuming is causing the issue:
I’d assume this is why the default position on my end is showing right at the bottom.
I’ve reached out to my themes creators to see if I can add a custom element to Single Product Structure options, hopefully it’s possible ??
I tried to use the hook you provided to include the release date with the short description, but haven’t had any luck.
Is there a guide you can link me to please, so I can check the code I’m using is correct?Thank you!
Hi @ok9xnirab,
Okay I think I might be getting somewhere!
I can add text after the short description using this code:
add_filter( 'woocommerce_short_description', 'woo_add_text_after_excerpt_single_product', 20, 1 ); function woo_add_text_after_excerpt_single_product( $post_excerpt ){ /* Add Custom Text after the Product Short Description on product page */ $post_excerpt .= '<p>'.__('Custom Text:').'</p>'; return $post_excerpt; }
What can replace “<p>’.__(‘Custom Text:’).'</p>’;” with for the ‘current product release date’ from your plugin to be displayed?
I’ve had a couple of attempts but can’t seem to get it to work ??
Thank you!
Hello again @ok9xnirab,
Okay almost done! ??
So I’ve managed to get the date to post where I’d like and in the specific product categories I need using this:
add_filter( 'woocommerce_short_description', 'woo_add_text_after_excerpt_single_product', 20, 1 ); function woo_add_text_after_excerpt_single_product( $post_excerpt ){ if( has_term( array( 'Comic Book Pre-orders', 'DC Comics Pre-orders', 'Marvel Comics Pre-orders', 'Other Publisher Pre-orders' ), 'product_cat' ) ) { /* Add Custom Text after the Product Short Description on product page */ global $product; $rels_date = $product->get_meta( '_preorder_product_release_date', true ); $post_excerpt .= '<p><strong>Release date: </strong>'.__($rels_date).'</p>'; } return $post_excerpt; }
The only thin g is it displays the date in a different format to the one you use.
The above code display like so:
Release date:?2023-05-04
How can I alter the date display to the format the plugin uses?Release Date: May 04, 2023
Thanks again for all your help!
$post_excerpt .= '<p><strong>Release date: </strong>'.date( 'F d, Y', strtotime( $rels_date ) ).'</p>';
Perfect! Thank you!
Okay so last thing… I really appreciate all your help with this ??
Now that I’m displaying the date via a function how should I hide the display the plugin shows?
- This reply was modified 1 year, 8 months ago by JapeNZ.
Hi @ok9xnirab,
I’ve been trying to work out how to hide the default pre-order message, but it has defeated me haha!
Would it be possible to add a ‘Hidden’ option in the label position setting?
Or perhaps you could add a class to the pre-order message display, so I could hide it with css?Thanks again!
We’ve added various classes on label, marker in v1.0.5. For your case ,
p.sdevs_preorder_single_notice { display: none; }
Thanks.
Awesome, thank you!
Awesome, thank you!
Most welcome. It’s my pleasure.
- The topic ‘Reposition Release Date’ is closed to new replies.