← All changes
|
app/Hooks/Handlers/BlockEditors/Checkout/InnerBlocks/InnerBlocks.php
+20
-18
1.3.21
→
1.7.1
View file →
| @@ -561,8 +561,9 @@ | ||
| 561 | 561 | <div <?php echo $atts; ?>> |
| 562 | 562 | <?php |
| 563 | 563 | $renderer = new CheckoutRenderer($cart); |
| 564 | 564 | $renderer->renderNameFields(); |
| 565 | + $renderer->renderB2BToggle(); | |
| 565 | 566 | $renderer->renderCreateAccountField(); |
| 566 | 567 | ?> |
| 567 | 568 | </div> |
| 568 | 569 | <?php |
| @@ -697,13 +698,15 @@ | ||
| 697 | 698 | 'class' => 'fct_checkout_payment_methods', |
| 698 | 699 | 'data-fluent-cart-checkout-payment-methods' => '' |
| 699 | 700 | ]); |
| 700 | 701 | ob_start(); ?> |
| 702 | + <?php do_action('fluent_cart/before_payment_methods', ['cart' => $cart]); ?> | |
| 701 | 703 | <div <?php echo $atts; ?>> |
| 702 | 704 | <?php |
| 703 | 705 | (new CheckoutRenderer($cart))->renderPaymentMethods(); |
| 704 | 706 | ?> |
| 705 | 707 | </div> |
| 708 | + <?php do_action('fluent_cart/after_payment_methods', ['cart' => $cart]); ?> | |
| 706 | 709 | <?php |
| 707 | 710 | return ob_get_clean(); |
| 708 | 711 | } |
| 709 | 712 | |
| @@ -708,24 +711,13 @@ | ||
| 708 | 711 | } |
| 709 | 712 | |
| 710 | 713 | public function renderCheckoutEuVat($attributes, $content, $block) |
| 711 | 714 | { |
| 712 | - $cart = $this->getCart(); | |
| 713 | - if (empty(Arr::get($cart, 'cart_data', []))) { | |
| 714 | - return ''; | |
| 715 | - } | |
| 716 | - | |
| 717 | - ob_start(); | |
| 718 | - do_action('fluent_cart/before_payment_methods', ['cart' => $cart]); | |
| 719 | - $output = ob_get_clean(); | |
| 720 | - | |
| 721 | - if (empty(trim($output))) { | |
| 722 | - return ''; | |
| 723 | - } | |
| 724 | - | |
| 725 | - $atts = get_block_wrapper_attributes(); | |
| 726 | - | |
| 727 | - return sprintf('<div %s>%s</div>', $atts, $output); | |
| 715 | + // Deprecated: VAT is now rendered inside the B2B section by renderCheckoutNameFields. | |
| 716 | + // Returning empty prevents a second, unwrapped VAT field from appearing outside | |
| 717 | + // the [data-fluent-cart-b2b-section] toggle on checkouts that still have this | |
| 718 | + // block in their saved template. | |
| 719 | + return ''; | |
| 728 | 720 | } |
| 729 | 721 | |
| 730 | 722 | public function renderCheckoutAgreeTermsField($attributes, $content, $block) |
| 731 | 723 | { |
| @@ -925,11 +917,12 @@ | ||
| 925 | 917 | $cart = $this->getCart(); |
| 926 | 918 | if (empty(Arr::get($cart, 'cart_data', []))) { |
| 927 | 919 | return ''; |
| 928 | 920 | } |
| 929 | - $atts = get_block_wrapper_attributes(); | |
| 930 | 921 | ob_start(); |
| 931 | - (new CartSummaryRender($cart))->showManualDiscount($atts); | |
| 922 | + (new CartSummaryRender($cart))->showUpgradeDiscount(); | |
| 923 | + (new CartSummaryRender($cart))->showProrateCredit(); | |
| 924 | + (new CartSummaryRender($cart))->showManualDiscount(); | |
| 932 | 925 | return ob_get_clean(); |
| 933 | 926 | } |
| 934 | 927 | |
| 935 | 928 | public function renderCheckoutTax($attributes, $content, $block) |
| @@ -980,8 +973,17 @@ | ||
| 980 | 973 | $cart = $this->getCart(); |
| 981 | 974 | if (empty(Arr::get($cart, 'cart_data', []))) { |
| 982 | 975 | return ''; |
| 983 | 976 | } |
| 977 | + | |
| 978 | + // A cart bound to an existing payment (custom payment link, renewal invoice, early | |
| 979 | + // installment) or already carrying an upgrade cannot take new items — the | |
| 980 | + // apply_order_bump handler refuses it, so rendering the bump would only offer a | |
| 981 | + // control that fails. Same predicate on both sides so they cannot drift. | |
| 982 | + if (!$cart->acceptsAdditionalItems()) { | |
| 983 | + return ''; | |
| 984 | + } | |
| 985 | + | |
| 984 | 986 | $atts = get_block_wrapper_attributes(); |
| 985 | 987 | $title = Arr::get($attributes, 'section_title'); |
| 986 | 988 | ob_start(); |
| 987 | 989 | ?> |