WooCommerce 預設有幾種商品類型,在新增商品時,你可以選擇以下四種商品類型
-
Simple (簡單商品):又可選擇商品為虛擬(Virtual)或可下載商品(Downloadable)
-
Grouped (組合商品)
-
External or Affiliate (外部/加盟商品)
- Variable (可變商品)
但有時候商店的商品種類是很限定的,像是大多數的商店並沒有組合商品或是外部和加盟商品,為了避免後台操作者的困惑,你可以選擇把不需要的選項拿掉。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'product_type_selector', 'remove_product_types' ); | |
function remove_product_types( $types ){ | |
unset( $types['grouped'] ); | |
unset( $types['external'] ); | |
return $types; | |
} |
參考連結
https://cartible.com/tips/customizing-product-types-selectbox-in-woocommerce/