Automattic\WooCommerce\Blocks\BlockTypes
CouponCode::enqueue_data
Expose coupon types to the editor JS via AssetDataRegistry.
Method of the class: CouponCode{}
No Hooks.
Returns
null. Nothing (null).
Usage
// protected - for code of main (parent) or child class $result = $this->enqueue_data( $attributes ): void;
- $attributes(array)
- Block attributes.
Default:array()
CouponCode::enqueue_data() CouponCode::enqueue data code WC 10.8.1
protected function enqueue_data( array $attributes = array() ): void {
parent::enqueue_data( $attributes );
if ( ! $this->asset_data_registry->exists( 'couponTypes' ) && function_exists( 'wc_get_coupon_types' ) ) {
$this->asset_data_registry->add( 'couponTypes', wc_get_coupon_types() );
}
}