Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Uplift › Text under the price
New Landing › How can we help? › Themeforest Theme Support › Uplift › Text under the price
- This topic has 10 replies, 3 voices, and was last updated 6 years by David Martin – Support.
-
Posted in: Uplift
-
June 4, 2017 at 12:13 pm #326829
Hi Guys,
I would like to add a formatted text (with modal) on each product page right under the price.
Can you please advise how can I achieve that without adding the code individually on each product page?Thanks!
June 4, 2017 at 12:16 pm #326830This reply has been marked as private.June 6, 2017 at 11:06 am #327119You would write a function to hook into the
do_action
within the WooCommerce single product template file.If you look at the file, you can see:
do_action( 'woocommerce_single_product_summary' );
Knowing this, you can then use your child theme to add the code snippet.
Ex:
// Add code below product price function sf_child_theme_single_product_below_price_code() { ?> <!-- Your code here --> <?php } add_action( 'woocommerce_single_product_summary', 'sf_child_theme_single_product_below_price_code' );
I’d recommend you add your above code to a new SPB Section and then reference the SPB Section ID shortcode in the above function example. I do not recommend you paste in your code chunk above straight into that function.
June 6, 2017 at 12:44 pm #327157This reply has been marked as private.June 6, 2017 at 12:57 pm #327160This reply has been marked as private.June 6, 2017 at 1:02 pm #327167Hi,
The ID is in the SPB Section URL, from your screenshot that looks like
22094
.The shortcode would be this:
[spb_section spb_section_id="14975" width="1/1" el_position="first last"]
So together you could use:
// Add code below product price function sf_child_theme_single_product_below_price_code() { ?> [spb_section spb_section_id="14975" width="1/1" el_position="first last"] <?php } add_action( 'woocommerce_single_product_summary', 'sf_child_theme_single_product_below_price_code' );
June 6, 2017 at 1:06 pm #327172Try this line instead.
do_shortcode('[spb_section spb_section_id="22094" width="1/1" el_position="first last"]');
-Rui
June 6, 2017 at 1:12 pm #327177This reply has been marked as private.June 6, 2017 at 1:22 pm #327180Hi,
You need will need some PHP experience to do this modification.
// Add code below product price function sf_child_theme_single_product_below_price_code() { echo do_shortcode('[spb_section spb_section_id="22094" width="1/1" el_position="first last"]'); } add_action( 'woocommerce_single_product_summary', 'sf_child_theme_single_product_below_price_code' );
June 6, 2017 at 1:45 pm #327183Woohoo, works perfectly, thank you!
June 6, 2017 at 2:23 pm #327190Glad to help!
If you have found the theme/support useful, we appreciate it if you can leave feedback on our item if you have the time as it really helps us out.
-
Posted in: Uplift
You must be logged in to reply to this topic.