I use WooCommerce on WordPress. Now when I click (open) some product I have to scroll down lot, because there is long header and menu before product itself.
So, my question is: How to add anchor to product link when I click (open) it?
If you don't understand, please ask me.
I use WooCommerce on WordPress. Now when I click (open) some product I have to scroll down lot, because there is long header and menu before product itself.
So, my question is: How to add anchor to product link when I click (open) it?
If you don't understand, please ask me.
Share Improve this question edited Jun 8, 2019 at 8:32 fuxia♦ 107k39 gold badges255 silver badges459 bronze badges asked Jun 8, 2019 at 7:17 JuusoJuuso 31 bronze badge1 Answer
Reset to default 1You can use the woocommerce_loop_product_link
filter to modify the archive product urls.
// Add to (child) theme functions.php
function my_prefix_modify_woocommerce_loop_product_link( $url, $product ) {
/**
* Adds the id of the product wrap element from single product view
* as an anchor parameter to the WooC archive loop product url
* e.g. http://www.mystore/my-product#single-produt-wrap-id
* update "single-produt-wrap-id" to match your setup
*/
return $url . "#single-produt-wrap-id";
}
add_filter( 'woocommerce_loop_product_link', 'my_prefix_modify_woocommerce_loop_product_link', 10, 2 );