Ich versuche, einen benutzerdefinierten variablen Produkttyp von woocommerce für ein Buchungsformular zu erstellen, das basierend auf einer Reihe von Variablen unterschiedliche Preise hat.
Ich habe erfolgreich einen benutzerdefinierten Produkttyp hinzugefügt. Aber wie dupliziere ich dieselbe Option, die das variable Produkt für unterschiedliche Attributpreise hat? Kann anscheinend keine Ressourcen finden, die sich auf variable Produkttypen beziehen.
// add a product type
add_filter( 'product_type_selector', 'cpt_add_custom_product_type' );
function cpt_add_custom_product_type( $types ){
$types[ 'booking_product' ] = __( 'Booking Product' );
return $types;
}
add_action( 'plugins_loaded', 'cpt_create_custom_product_type' );
function cpt_create_custom_product_type(){
// declare the product class
class WC_Product_Wdm extends WC_Product_Variable {
public function __construct( $product ) {
$this->product_type="booking_product";
parent::__construct( $product );
// add additional functions here
}
}
}