mirror of
https://gh.wpcy.net/https://github.com/mainwp/Code-Snippets-Functions.git
synced 2026-05-01 11:52:25 +08:00
https://stackoverflow.com/questions/66217896/display-woocommerce-attribute-below-the-product-title-in-my-account-page/66249549
18 lines
651 B
Text
18 lines
651 B
Text
add_filter( 'woocommerce_product_variation_title_include_attributes', '__return_false' );
|
|
add_filter( 'woocommerce_is_attribute_in_product_name', '__return_false' );
|
|
|
|
add_filter( 'woocommerce_product_variation_title_include_attributes', 'show_attributes_outside_title_1' );
|
|
function show_attributes_outside_title_1( $enabled ) {
|
|
if ( is_account_page() ) {
|
|
$enabled = true;
|
|
}
|
|
return $enabled;
|
|
}
|
|
|
|
add_filter( 'woocommerce_is_attribute_in_product_name', 'show_attributes_outside_title_2' );
|
|
function show_attributes_outside_title_2( $enabled ) {
|
|
if ( ! is_account_page() ) {
|
|
$enabled = false;
|
|
}
|
|
return $enabled;
|
|
}
|