Home Forums WoodMart support forum For single product. Extra content position : After content

For single product. Extra content position : After content

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #419345

    loralora
    Participant

    Hello

    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
    prefooter

    Attachments:
    You must be logged in to view attached files.
    #419670

    Hello,

    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

    #419932

    Hello,

    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

    #420605

    loralora
    Participant

    Hello, 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);
    #420988

    Hello,

    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_categorydisplays only certain category which should be inserted without any child categories.

    If you have any questions please feel free to contact us.

    Best Regards

    #421040

    loralora
    Participant

    Unfortunately this doesn’t work.
    Content does not appear

    Could you test this on your side?

    #421413

    Hello,

    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

    #421685

    loralora
    Participant

    thanks for the help!

    #421732

    You are welcome! We are here to help.

    Wish you a wonderful day!

Viewing 9 posts - 1 through 9 (of 9 total)

The topic ‘For single product. Extra content position : After content’ is closed to new replies.