Home › Forums › WoodMart support forum › For single product. Extra content position : After content
For single product. Extra content position : After content
- This topic has 8 replies, 2 voices, and was last updated 2 years, 10 months ago by
Elise Noromit.
-
AuthorPosts
-
November 7, 2022 at 8:14 pm #419345
loraloraParticipantHello
1. Please tell me what action to use to put the content in Extra content position : After content
I used this
function my_custom_function { // Some Code Here } add_filter( 'woocommerce_after_single_product_summary', 'my_custom_function', 10 );
But the content appears as if inside the tab, albeit from above. And if I use separate settings for each product (see photo) and choose a shortcode there, then a “container” is created there.
Could you tell me all the hooks that you use for the action shown in the photo?
namely:Extra content position :
After content
Before content
prefooterAttachments:
You must be logged in to view attached files.November 9, 2022 at 3:44 am #419670
Elise NoromitMemberHello,
I will get this information from our developers.
Meanwhile, I would like to suggest WooCommerce layouts builder for your consideration: https://xtemos.com/docs-cat/woocommerce-layouts-builder/?theme=woodmart
You can create any template for a single product, category, or shop page with the builder you have.
Best Regards
November 9, 2022 at 9:00 pm #419932
Elise NoromitMemberHello,
Here are the hooks:
After content:
add_action( 'woodmart_after_product_content', 'woodmart_product_extra_content', 20 );
2. Before content:
add_action( 'woocommerce_before_single_product', 'woodmart_product_extra_content', 20 );
3. prefooter:
add_action( 'woodmart_woocommerce_after_sidebar', 'woodmart_product_extra_content', 30 );
If you have any questions please feel free to contact us.
Best Regards
November 12, 2022 at 4:22 pm #420605
loraloraParticipantHello, thanks for the help.
Can I ask you for more help?
I’m new to php, it seems to me that I wrote everything correctly, but the code does not add the html block content (it just contains text) to the field I need. I have cleared the cache but no result.
Also, as far as I understand, the content will be displayed only if the product category is “woman”. (ID 232) But it will not be displayed if the product is in a subcategory, for example “Clothes”. (ID 240).
I could use “array”, but then I would have to list all the subcategories and there are a lot of them. Is there an easier solution?
Thanks for your help if possible
function add_content_below_woodmart_after_product_content() { global $product; if( is_category( 'woman' ) ){ echo do_shortcode('[html_block id="11762"]'); } } add_action('woodmart_after_product_content', 'add_content_below_woodmart_after_product_content', 10);
November 14, 2022 at 4:16 pm #420988
Elise NoromitMemberHello,
HTML block is shown by means of this function:
function add_content_below_woodmart_after_product_content() { if( is_category( 'woman' ) ){ echo woodmart_get_html_block( '11762' ); } } add_action('woodmart_after_product_content', 'add_content_below_woodmart_after_product_content', 10);
The function
is_category
displays only certain category which should be inserted without any child categories.If you have any questions please feel free to contact us.
Best Regards
November 14, 2022 at 6:13 pm #421040
loraloraParticipantUnfortunately this doesn’t work.
Content does not appearCould you test this on your side?
November 16, 2022 at 3:51 am #421413
Elise NoromitMemberHello,
This function is_category works only on the product archive page.
You will need this code and insert the product category ID:
function add_content_below_woodmart_after_product_content() { global $product; $category_ids = array( 49, 53 ); foreach ( $category_ids as $category_id ) { if( in_array( $category_id, $product->get_category_ids() ) ) { echo woodmart_get_html_block( '6915' ); return; } } } add_action('woodmart_after_product_content', 'add_content_below_woodmart_after_product_content', 10);
Best Regards
November 16, 2022 at 9:38 pm #421685
loraloraParticipantthanks for the help!
November 17, 2022 at 5:48 am #421732
Elise NoromitMemberYou are welcome! We are here to help.
Wish you a wonderful day!
-
AuthorPosts
The topic ‘For single product. Extra content position : After content’ is closed to new replies.
- You must be logged in to create new topics. Login / Register