Woocommerceの「属性」にカテゴリーのように「親」と「子」を作成できればいいと思ったことはありませんか?
かつてはこの機能がありましたがバージョンアップを経てなくなってしまいました。
現在のバージョンでも利用可能にするためには、テーマ(子テーマ使用時は子テーマ)の「functions.php」に下記コードを追記してください。
if( function_exists( 'WC' ) ){
add_action( 'init', 'ag_woocommerce_register_taxonomies_hack', 4 );
if( ! function_exists( 'ag_woocommerce_register_taxonomies_hack' ) ){
function ag_woocommerce_register_taxonomies_hack(){
if( $attribute_taxonomies = wc_get_attribute_taxonomies() ) {
foreach ($attribute_taxonomies as $tax) {
if ($name = wc_attribute_taxonomy_name($tax->attribute_name)) {
add_filter( "woocommerce_taxonomy_args_{$name}", 'ag_woocommerce_taxonomy_product_attribute_args' );
}
}
}
}
}
if( ! function_exists( 'ag_woocommerce_taxonomy_product_attribute_args' ) ){
function ag_woocommerce_taxonomy_product_attribute_args( $taxonomy_data ){
$taxonomy_data['hierarchical'] = true;
return $taxonomy_data;
}
}
}
Web コード プラグインなし
長いリンク(URL)がはみ出すときのCSS。スマホでも対策OK!
スマートフォンで見ると、長いリ...
続きを見る植物
Copiapoa cinerea var. cinerea コピアポア シネレア 黒王丸
黒王丸 コピアポア・シネレア ...
続きを見る7月
Web Wordpress コード スピード プラグインなし
プラグインなし!目次を実装する方法。|WordPress
WordPressで、プラグイ...
続きを見る7月
Web コード プラグインなし
wp-config.phpにとりあえず書いとくやつ。
define( 'WP_DEB...
続きを見るコード
サーバー内でzipファイルを解凍する方法
解凍したいファイルを「exam...
続きを見る