Skip to content

Instantly share code, notes, and snippets.

View erikyo's full-sized avatar

Erik Golinelli erikyo

View GitHub Profile
@erikyo
erikyo / woocommerce_switch_tab_via_url.php
Last active August 11, 2021 19:03 — forked from corsonr/gist:0e0a4dfaacf59fdca314
WooCommerce: activate product tabs from URL (support with history states, share link to tab with hash)
<?php
/**
* wc_direct_link_to_product_tabs
*
* Allows you to create custom URLs to activate product tabs by default, directly from the URL.
* ex: http://mysite.com/my-product-name#reviews
* this fork add history.pushState and each tab will be treated as a page
* so you can use browser history back / forward to move along tabs
*/
add_action( 'wp_footer', function () {