Automattic\WooCommerce\Blocks\BlockTypes

ProductAddToCart{}WC 1.0

ProductAddToCart class.

Хуков нет.

Использование

$ProductAddToCart = new ProductAddToCart();
// use class methods

Методы

  1. protected register_block_type_assets()

Код ProductAddToCart{} WC 6.8.0

class ProductAddToCart extends AbstractBlock {

	/**
	 * Block name.
	 *
	 * @var string
	 */
	protected $block_name = 'product-add-to-cart';

	/**
	 * API version name.
	 *
	 * @var string
	 */
	protected $api_version = '2';

	/**
	 * Register script and style assets for the block type before it is registered.
	 *
	 * This registers the scripts; it does not enqueue them.
	 */
	protected function register_block_type_assets() {
		parent::register_block_type_assets();
		$this->register_chunk_translations( [ $this->block_name ] );
	}
}