Accordion
1 year ago
AddToCartWithOptions
2 weeks ago
OrderConfirmation
2 months ago
ProductCollection
3 weeks ago
Reviews
2 months ago
AbstractBlock.php
4 weeks ago
AbstractDynamicBlock.php
2 years ago
AbstractInnerBlock.php
1 year ago
AbstractProductGrid.php
3 months ago
ActiveFilters.php
2 years ago
AddToCartForm.php
4 weeks ago
AddToWishlistButton.php
4 weeks ago
AllProducts.php
2 years ago
AllReviews.php
2 years ago
AtomicBlock.php
2 years ago
AttributeFilter.php
1 year ago
Breadcrumbs.php
1 year ago
Cart.php
2 months ago
CartAcceptedPaymentMethodsBlock.php
2 years ago
CartCrossSellsBlock.php
2 years ago
CartCrossSellsProductsBlock.php
2 years ago
CartExpressPaymentBlock.php
1 year ago
CartItemsBlock.php
2 years ago
CartLineItemsBlock.php
2 years ago
CartLink.php
2 months ago
CartOrderSummaryBlock.php
2 years ago
CartOrderSummaryCouponFormBlock.php
2 years ago
CartOrderSummaryDiscountBlock.php
2 years ago
CartOrderSummaryFeeBlock.php
2 years ago
CartOrderSummaryHeadingBlock.php
2 years ago
CartOrderSummaryShippingBlock.php
2 years ago
CartOrderSummarySubtotalBlock.php
2 years ago
CartOrderSummaryTaxesBlock.php
2 years ago
CartOrderSummaryTotalsBlock.php
2 years ago
CartTotalsBlock.php
2 years ago
CatalogSorting.php
4 weeks ago
CategoryDescription.php
2 months ago
CategoryTitle.php
2 months ago
Checkout.php
2 months ago
CheckoutActionsBlock.php
1 year ago
CheckoutAdditionalInformationBlock.php
2 years ago
CheckoutBillingAddressBlock.php
2 years ago
CheckoutContactInformationBlock.php
2 years ago
CheckoutExpressPaymentBlock.php
9 months ago
CheckoutFieldsBlock.php
2 years ago
CheckoutOrderNoteBlock.php
2 years ago
CheckoutOrderSummaryBlock.php
2 years ago
CheckoutOrderSummaryCartItemsBlock.php
2 years ago
CheckoutOrderSummaryCouponFormBlock.php
2 years ago
CheckoutOrderSummaryDiscountBlock.php
2 years ago
CheckoutOrderSummaryFeeBlock.php
2 years ago
CheckoutOrderSummaryShippingBlock.php
2 years ago
CheckoutOrderSummarySubtotalBlock.php
2 years ago
CheckoutOrderSummaryTaxesBlock.php
2 years ago
CheckoutOrderSummaryTotalsBlock.php
2 years ago
CheckoutPaymentBlock.php
2 years ago
CheckoutPickupOptionsBlock.php
2 years ago
CheckoutShippingAddressBlock.php
2 years ago
CheckoutShippingMethodBlock.php
2 years ago
CheckoutShippingMethodsBlock.php
2 years ago
CheckoutTermsBlock.php
2 years ago
CheckoutTotalsBlock.php
2 years ago
ClassicShortcode.php
1 year ago
ClassicTemplate.php
4 months ago
ComingSoon.php
1 year ago
CouponCode.php
2 months ago
CustomerAccount.php
3 months ago
Dropdown.php
4 weeks ago
EmailContent.php
5 months ago
EmptyCartBlock.php
2 years ago
EmptyMiniCartContentsBlock.php
11 months ago
EnableBlockJsonAssetsTrait.php
1 year ago
FeaturedCategory.php
7 months ago
FeaturedItem.php
7 months ago
FeaturedProduct.php
7 months ago
FilledCartBlock.php
2 years ago
FilledMiniCartContentsBlock.php
4 months ago
FilterWrapper.php
2 years ago
HandpickedProducts.php
1 year ago
MiniCart.php
4 weeks ago
MiniCartCartButtonBlock.php
11 months ago
MiniCartCheckoutButtonBlock.php
11 months ago
MiniCartContents.php
3 months ago
MiniCartFooterBlock.php
4 weeks ago
MiniCartItemsBlock.php
11 months ago
MiniCartProductsTableBlock.php
4 weeks ago
MiniCartShoppingButtonBlock.php
9 months ago
MiniCartTitleBlock.php
11 months ago
MiniCartTitleItemsCounterBlock.php
11 months ago
MiniCartTitleLabelBlock.php
11 months ago
NextPreviousButtons.php
5 months ago
PageContentWrapper.php
2 years ago
PaymentMethodIcons.php
11 months ago
PriceFilter.php
1 year ago
ProceedToCheckoutBlock.php
2 years ago
ProductAverageRating.php
1 year ago
ProductBestSellers.php
2 years ago
ProductButton.php
2 months ago
ProductCategories.php
4 weeks ago
ProductCategory.php
2 years ago
ProductDescription.php
9 months ago
ProductDetails.php
5 months ago
ProductFilterActive.php
4 weeks ago
ProductFilterAttribute.php
4 weeks ago
ProductFilterCheckboxList.php
4 weeks ago
ProductFilterChips.php
4 weeks ago
ProductFilterClearButton.php
4 weeks ago
ProductFilterPrice.php
4 weeks ago
ProductFilterPriceSlider.php
4 weeks ago
ProductFilterRating.php
4 weeks ago
ProductFilterRemovableChips.php
4 weeks ago
ProductFilterStatus.php
4 weeks ago
ProductFilterTaxonomy.php
4 weeks ago
ProductFilters.php
3 weeks ago
ProductGallery.php
4 weeks ago
ProductGalleryLargeImage.php
4 weeks ago
ProductGalleryThumbnails.php
4 weeks ago
ProductImage.php
4 weeks ago
ProductImageGallery.php
7 months ago
ProductMeta.php
1 year ago
ProductNew.php
2 years ago
ProductOnSale.php
2 years ago
ProductPrice.php
2 months ago
ProductQuery.php
4 weeks ago
ProductRating.php
1 year ago
ProductRatingCounter.php
1 year ago
ProductRatingStars.php
1 year ago
ProductResultsCount.php
2 months ago
ProductSKU.php
2 months ago
ProductSaleBadge.php
1 year ago
ProductSearch.php
10 months ago
ProductSpecifications.php
2 months ago
ProductStockIndicator.php
2 months ago
ProductSummary.php
7 months ago
ProductTag.php
2 years ago
ProductTemplate.php
2 months ago
ProductTitle.php
1 year ago
ProductTopRated.php
2 years ago
ProductsByAttribute.php
2 years ago
RatingFilter.php
2 years ago
RelatedProducts.php
3 months ago
ReviewsByCategory.php
2 years ago
ReviewsByProduct.php
2 years ago
SavedForLater.php
4 weeks ago
SingleProduct.php
2 months ago
StockFilter.php
2 years ago
StoreNotices.php
1 year ago
Wishlist.php
4 weeks ago
Cart.php
348 lines
| 1 | <?php |
| 2 | namespace Automattic\WooCommerce\Blocks\BlockTypes; |
| 3 | |
| 4 | use Automattic\WooCommerce\Blocks\Utils\CartCheckoutUtils; |
| 5 | |
| 6 | /** |
| 7 | * Cart class. |
| 8 | * |
| 9 | * @internal |
| 10 | */ |
| 11 | class Cart extends AbstractBlock { |
| 12 | /** |
| 13 | * Block name. |
| 14 | * |
| 15 | * @var string |
| 16 | */ |
| 17 | protected $block_name = 'cart'; |
| 18 | |
| 19 | /** |
| 20 | * Chunks build folder. |
| 21 | * |
| 22 | * @var string |
| 23 | */ |
| 24 | protected $chunks_folder = 'cart-blocks'; |
| 25 | |
| 26 | /** |
| 27 | * Initialize this block type. |
| 28 | * |
| 29 | * - Hook into WP lifecycle. |
| 30 | * - Register the block with WordPress. |
| 31 | */ |
| 32 | protected function initialize() { |
| 33 | parent::initialize(); |
| 34 | add_action( 'wp_loaded', array( $this, 'register_patterns' ) ); |
| 35 | add_action( 'wp', array( $this, 'disable_wp_emoji' ) ); |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Remove WordPress emoji detection script on pages containing this block. |
| 40 | * |
| 41 | * The wp-emoji MutationObserver converts emoji text nodes to <img> elements |
| 42 | * when React hydrates or re-renders, corrupting the DOM tree and crashing the block. |
| 43 | * The wp-exclude-emoji class on the wrapper only prevents the initial parse, not the |
| 44 | * MutationObserver, so the script must be removed entirely. |
| 45 | * |
| 46 | * @since 10.8.0 |
| 47 | * |
| 48 | * @return void |
| 49 | */ |
| 50 | public function disable_wp_emoji() { |
| 51 | if ( has_block( $this->get_full_block_name() ) ) { |
| 52 | remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); |
| 53 | remove_action( 'wp_print_styles', 'print_emoji_styles' ); |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Dequeues the scripts added by WC Core to the Cart page. |
| 59 | * |
| 60 | * @return void |
| 61 | */ |
| 62 | public function dequeue_woocommerce_core_scripts() { |
| 63 | wp_dequeue_script( 'wc-cart' ); |
| 64 | wp_dequeue_script( 'wc-password-strength-meter' ); |
| 65 | wp_dequeue_script( 'selectWoo' ); |
| 66 | wp_dequeue_style( 'select2' ); |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * Register block pattern for Empty Cart Message to make it translatable. |
| 71 | */ |
| 72 | public function register_patterns() { |
| 73 | $shop_permalink = wc_get_page_permalink( 'shop' ); |
| 74 | |
| 75 | register_block_pattern( |
| 76 | 'woocommerce/cart-heading', |
| 77 | array( |
| 78 | 'title' => '', |
| 79 | 'inserter' => false, |
| 80 | 'content' => '<!-- wp:heading {"align":"wide", "level":1} --><h1 class="wp-block-heading alignwide">' . esc_html__( 'Cart', 'woocommerce' ) . '</h1><!-- /wp:heading -->', |
| 81 | ) |
| 82 | ); |
| 83 | register_block_pattern( |
| 84 | 'woocommerce/cart-cross-sells-message', |
| 85 | array( |
| 86 | 'title' => '', |
| 87 | 'inserter' => false, |
| 88 | 'content' => '<!-- wp:heading {"fontSize":"large"} --><h2 class="wp-block-heading has-large-font-size">' . esc_html__( 'You may be interested in…', 'woocommerce' ) . '</h2><!-- /wp:heading -->', |
| 89 | ) |
| 90 | ); |
| 91 | register_block_pattern( |
| 92 | 'woocommerce/cart-empty-message', |
| 93 | array( |
| 94 | 'title' => '', |
| 95 | 'inserter' => false, |
| 96 | 'content' => ' |
| 97 | <!-- wp:heading {"textAlign":"center","className":"with-empty-cart-icon wc-block-cart__empty-cart__title"} --><h2 class="wp-block-heading has-text-align-center with-empty-cart-icon wc-block-cart__empty-cart__title">' . esc_html__( 'Your cart is currently empty!', 'woocommerce' ) . '</h2><!-- /wp:heading --> |
| 98 | <!-- wp:paragraph {"align":"center"} --><p class="has-text-align-center"><a href="' . esc_attr( esc_url( $shop_permalink ) ) . '">' . esc_html__( 'Browse store', 'woocommerce' ) . '</a></p><!-- /wp:paragraph --> |
| 99 | ', |
| 100 | ) |
| 101 | ); |
| 102 | register_block_pattern( |
| 103 | 'woocommerce/cart-new-in-store-message', |
| 104 | array( |
| 105 | 'title' => '', |
| 106 | 'inserter' => false, |
| 107 | 'content' => '<!-- wp:heading {"textAlign":"center"} --><h2 class="wp-block-heading has-text-align-center">' . esc_html__( 'New in store', 'woocommerce' ) . '</h2><!-- /wp:heading -->', |
| 108 | ) |
| 109 | ); |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * Get the editor script handle for this block type. |
| 114 | * |
| 115 | * @param string $key Data to get, or default to everything. |
| 116 | * @return array|string; |
| 117 | */ |
| 118 | protected function get_block_type_editor_script( $key = null ) { |
| 119 | $script = [ |
| 120 | 'handle' => 'wc-' . $this->block_name . '-block', |
| 121 | 'path' => $this->asset_api->get_block_asset_build_path( $this->block_name ), |
| 122 | 'dependencies' => [ 'wc-blocks' ], |
| 123 | ]; |
| 124 | return $key ? $script[ $key ] : $script; |
| 125 | } |
| 126 | |
| 127 | /** |
| 128 | * Get the frontend script handle for this block type. |
| 129 | * |
| 130 | * @see $this->register_block_type() |
| 131 | * @param string $key Data to get, or default to everything. |
| 132 | * @return array|string |
| 133 | */ |
| 134 | protected function get_block_type_script( $key = null ) { |
| 135 | $script = [ |
| 136 | 'handle' => 'wc-' . $this->block_name . '-block-frontend', |
| 137 | 'path' => $this->asset_api->get_block_asset_build_path( $this->block_name . '-frontend' ), |
| 138 | 'dependencies' => [], |
| 139 | ]; |
| 140 | return $key ? $script[ $key ] : $script; |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * Get the frontend style handle for this block type. |
| 145 | * |
| 146 | * @return string[] |
| 147 | */ |
| 148 | protected function get_block_type_style() { |
| 149 | return array_merge( parent::get_block_type_style(), [ 'wc-blocks-packages-style' ] ); |
| 150 | } |
| 151 | |
| 152 | /** |
| 153 | * Enqueue frontend assets for this block, just in time for rendering. |
| 154 | * |
| 155 | * @param array $attributes Any attributes that currently are available from the block. |
| 156 | * @param string $content The block content. |
| 157 | * @param WP_Block $block The block object. |
| 158 | */ |
| 159 | protected function enqueue_assets( array $attributes, $content, $block ) { |
| 160 | /** |
| 161 | * Fires before cart block scripts are enqueued. |
| 162 | * |
| 163 | * @since 2.6.0 |
| 164 | */ |
| 165 | do_action( 'woocommerce_blocks_enqueue_cart_block_scripts_before' ); |
| 166 | parent::enqueue_assets( $attributes, $content, $block ); |
| 167 | /** |
| 168 | * Fires after cart block scripts are enqueued. |
| 169 | * |
| 170 | * @since 2.6.0 |
| 171 | */ |
| 172 | do_action( 'woocommerce_blocks_enqueue_cart_block_scripts_after' ); |
| 173 | } |
| 174 | |
| 175 | /** |
| 176 | * Append frontend scripts when rendering the Cart block. |
| 177 | * |
| 178 | * @param array $attributes Block attributes. |
| 179 | * @param string $content Block content. |
| 180 | * @param WP_Block $block Block instance. |
| 181 | * @return string Rendered block type output. |
| 182 | */ |
| 183 | protected function render( $attributes, $content, $block ) { |
| 184 | // Dequeue the core scripts when rendering this block. |
| 185 | add_action( 'wp_enqueue_scripts', array( $this, 'dequeue_woocommerce_core_scripts' ), 20 ); |
| 186 | |
| 187 | /** |
| 188 | * We need to check if $content has any templates from prior iterations of the block, in order to update to the latest iteration. |
| 189 | * We test the iteration version by searching for new blocks brought in by it. |
| 190 | * The blocks used for testing should be always available in the block (not removable by the user). |
| 191 | */ |
| 192 | |
| 193 | $regex_for_filled_cart_block = '/<div[^<]*?data-block-name="woocommerce\/filled-cart-block"[^>]*?>/mi'; |
| 194 | // Filled Cart block was added in i2, so we search for it to see if we have a Cart i1 template. |
| 195 | $has_i1_template = ! preg_match( $regex_for_filled_cart_block, $content ); |
| 196 | |
| 197 | if ( $has_i1_template ) { |
| 198 | /** |
| 199 | * This fallback structure needs to match the defaultTemplate variables defined in the block's edit.tsx files, |
| 200 | * starting from the parent block and going down each inner block, in the order the blocks were registered. |
| 201 | */ |
| 202 | $inner_blocks_html = '$0 |
| 203 | <div data-block-name="woocommerce/filled-cart-block" class="wp-block-woocommerce-filled-cart-block"> |
| 204 | <div data-block-name="woocommerce/cart-items-block" class="wp-block-woocommerce-cart-items-block"> |
| 205 | <div data-block-name="woocommerce/cart-line-items-block" class="wp-block-woocommerce-cart-line-items-block"></div> |
| 206 | </div> |
| 207 | <div data-block-name="woocommerce/cart-totals-block" class="wp-block-woocommerce-cart-totals-block"> |
| 208 | <div data-block-name="woocommerce/cart-order-summary-block" class="wp-block-woocommerce-cart-order-summary-block"></div> |
| 209 | <div data-block-name="woocommerce/cart-express-payment-block" class="wp-block-woocommerce-cart-express-payment-block"></div> |
| 210 | <div data-block-name="woocommerce/proceed-to-checkout-block" class="wp-block-woocommerce-proceed-to-checkout-block"></div> |
| 211 | <div data-block-name="woocommerce/cart-accepted-payment-methods-block" class="wp-block-woocommerce-cart-accepted-payment-methods-block"></div> |
| 212 | </div> |
| 213 | </div> |
| 214 | <div data-block-name="woocommerce/empty-cart-block" class="wp-block-woocommerce-empty-cart-block"> |
| 215 | '; |
| 216 | |
| 217 | $content = preg_replace( '/<div class="[a-zA-Z0-9_\- ]*wp-block-woocommerce-cart[a-zA-Z0-9_\- ]*">/mi', $inner_blocks_html, $content ); |
| 218 | $content = $content . '</div>'; |
| 219 | } |
| 220 | |
| 221 | /** |
| 222 | * Cart i3 added inner blocks for Order summary. We need to add them to Cart i2 templates. |
| 223 | * The order needs to match the order in which these blocks were registered. |
| 224 | */ |
| 225 | $order_summary_with_inner_blocks = '$0 |
| 226 | <div data-block-name="woocommerce/cart-order-summary-heading-block" class="wp-block-woocommerce-cart-order-summary-heading-block"></div> |
| 227 | <div data-block-name="woocommerce/cart-order-summary-subtotal-block" class="wp-block-woocommerce-cart-order-summary-subtotal-block"></div> |
| 228 | <div data-block-name="woocommerce/cart-order-summary-fee-block" class="wp-block-woocommerce-cart-order-summary-fee-block"></div> |
| 229 | <div data-block-name="woocommerce/cart-order-summary-discount-block" class="wp-block-woocommerce-cart-order-summary-discount-block"></div> |
| 230 | <div data-block-name="woocommerce/cart-order-summary-coupon-form-block" class="wp-block-woocommerce-cart-order-summary-coupon-form-block"></div> |
| 231 | <div data-block-name="woocommerce/cart-order-summary-shipping-form-block" class="wp-block-woocommerce-cart-order-summary-shipping-block"></div> |
| 232 | <div data-block-name="woocommerce/cart-order-summary-taxes-block" class="wp-block-woocommerce-cart-order-summary-taxes-block"></div> |
| 233 | '; |
| 234 | // Order summary subtotal block was added in i3, so we search for it to see if we have a Cart i2 template. |
| 235 | $regex_for_order_summary_subtotal = '/<div[^<]*?data-block-name="woocommerce\/cart-order-summary-subtotal-block"[^>]*?>/mi'; |
| 236 | $regex_for_order_summary = '/<div[^<]*?data-block-name="woocommerce\/cart-order-summary-block"[^>]*?>/mi'; |
| 237 | $has_i2_template = ! preg_match( $regex_for_order_summary_subtotal, $content ); |
| 238 | |
| 239 | if ( $has_i2_template ) { |
| 240 | $content = preg_replace( $regex_for_order_summary, $order_summary_with_inner_blocks, $content ); |
| 241 | } |
| 242 | |
| 243 | return $content; |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * Extra data passed through from server to client for block. |
| 248 | * |
| 249 | * @param array $attributes Any attributes that currently are available from the block. |
| 250 | * Note, this will be empty in the editor context when the block is |
| 251 | * not in the post content on editor load. |
| 252 | */ |
| 253 | protected function enqueue_data( array $attributes = [] ) { |
| 254 | parent::enqueue_data( $attributes ); |
| 255 | |
| 256 | $this->asset_data_registry->add( 'countryData', CartCheckoutUtils::get_country_data() ); |
| 257 | $this->asset_data_registry->add( 'displayItemizedTaxes', 'itemized' === get_option( 'woocommerce_tax_total_display' ) ); |
| 258 | $this->asset_data_registry->add( 'displayCartPricesIncludingTax', 'incl' === get_option( 'woocommerce_tax_display_cart' ) ); |
| 259 | $this->asset_data_registry->add( 'taxesEnabled', wc_tax_enabled() ); |
| 260 | $this->asset_data_registry->add( 'couponsEnabled', wc_coupons_enabled() ); |
| 261 | $this->asset_data_registry->add( 'shippingEnabled', wc_shipping_enabled() ); |
| 262 | $this->asset_data_registry->add( 'hasDarkEditorStyleSupport', current_theme_supports( 'dark-editor-style' ) ); |
| 263 | $this->asset_data_registry->register_page_id( isset( $attributes['checkoutPageId'] ) ? $attributes['checkoutPageId'] : 0 ); |
| 264 | $this->asset_data_registry->add( 'isBlockTheme', wp_is_block_theme() ); |
| 265 | $this->asset_data_registry->add( 'shippingMethodsExist', CartCheckoutUtils::shipping_methods_exist() > 0 ); |
| 266 | |
| 267 | $is_block_editor = $this->is_block_editor(); |
| 268 | |
| 269 | // Check `current_user_can` so we can show notices about incompatible extensions in the front-end to admins too. |
| 270 | if ( ( $is_block_editor || current_user_can( 'manage_woocommerce' ) ) && ! $this->asset_data_registry->exists( 'incompatibleExtensions' ) ) { |
| 271 | if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) && function_exists( 'get_plugins' ) ) { |
| 272 | $declared_extensions = \Automattic\WooCommerce\Utilities\FeaturesUtil::get_compatible_plugins_for_feature( 'cart_checkout_blocks' ); |
| 273 | $all_plugins = \get_plugins(); |
| 274 | $incompatible_extensions = array_reduce( |
| 275 | $declared_extensions['incompatible'], |
| 276 | function ( array $acc, $item ) use ( $all_plugins ) { |
| 277 | $plugin = $all_plugins[ $item ] ?? null; |
| 278 | $plugin_id = $plugin['TextDomain'] ?? dirname( $item ); |
| 279 | $plugin_name = $plugin['Name'] ?? $plugin_id; |
| 280 | $acc[] = [ |
| 281 | 'id' => $plugin_id, |
| 282 | 'title' => $plugin_name, |
| 283 | ]; |
| 284 | return $acc; |
| 285 | }, |
| 286 | [] |
| 287 | ); |
| 288 | $this->asset_data_registry->add( 'incompatibleExtensions', $incompatible_extensions ); |
| 289 | } |
| 290 | } |
| 291 | |
| 292 | // Hydrate the following data depending on admin or frontend context. |
| 293 | if ( ! is_admin() && ! WC()->is_rest_api_request() ) { |
| 294 | $this->asset_data_registry->hydrate_api_request( '/wc/store/v1/cart' ); |
| 295 | } |
| 296 | |
| 297 | /** |
| 298 | * Fires after cart block data is registered. |
| 299 | * |
| 300 | * @since 2.6.0 |
| 301 | */ |
| 302 | do_action( 'woocommerce_blocks_cart_enqueue_data' ); |
| 303 | } |
| 304 | |
| 305 | /** |
| 306 | * Register script and style assets for the block type before it is registered. |
| 307 | * |
| 308 | * This registers the scripts; it does not enqueue them. |
| 309 | */ |
| 310 | protected function register_block_type_assets() { |
| 311 | parent::register_block_type_assets(); |
| 312 | $chunks = $this->get_chunks_paths( $this->chunks_folder ); |
| 313 | $vendor_chunks = $this->get_chunks_paths( 'vendors--cart-blocks' ); |
| 314 | $shared_chunks = []; |
| 315 | $this->register_chunk_translations( array_merge( $chunks, $vendor_chunks, $shared_chunks ) ); |
| 316 | } |
| 317 | |
| 318 | /** |
| 319 | * Get list of Cart block & its inner-block types. |
| 320 | * |
| 321 | * @return array; |
| 322 | */ |
| 323 | public static function get_cart_block_types() { |
| 324 | return [ |
| 325 | 'Cart', |
| 326 | 'CartOrderSummaryTaxesBlock', |
| 327 | 'CartOrderSummarySubtotalBlock', |
| 328 | 'CartOrderSummaryTotalsBlock', |
| 329 | 'FilledCartBlock', |
| 330 | 'EmptyCartBlock', |
| 331 | 'CartTotalsBlock', |
| 332 | 'CartItemsBlock', |
| 333 | 'CartLineItemsBlock', |
| 334 | 'CartOrderSummaryBlock', |
| 335 | 'CartExpressPaymentBlock', |
| 336 | 'ProceedToCheckoutBlock', |
| 337 | 'CartAcceptedPaymentMethodsBlock', |
| 338 | 'CartOrderSummaryCouponFormBlock', |
| 339 | 'CartOrderSummaryDiscountBlock', |
| 340 | 'CartOrderSummaryFeeBlock', |
| 341 | 'CartOrderSummaryHeadingBlock', |
| 342 | 'CartOrderSummaryShippingBlock', |
| 343 | 'CartCrossSellsBlock', |
| 344 | 'CartCrossSellsProductsBlock', |
| 345 | ]; |
| 346 | } |
| 347 | } |
| 348 |