Task 7035 | рефакторинг контроллера чекаута

pull/36/head
parent fa4ec3fa53
commit 9faa1f1fe6
  1. 16
      wp-content/themes/cosmopet/modules/shop/components/checkout/component-controller.php
  2. 15
      wp-content/themes/cosmopet/woocommerce/checkout/form-checkout.php

@ -0,0 +1,16 @@
<?php
// Get Timber context
$context = Timber::context();
// Add WooCommerce-specific data to context
$context['checkout'] = WC()->checkout();
// In your theme's functions.php
add_filter('timber/twig', function($twig) {
$twig->addFunction(new \Twig\TwigFunction('WC', function() {
return WC();
}));
return $twig;
});

@ -11,19 +11,4 @@ if (!defined('ABSPATH')) {
exit;
}
// Get Timber context
$context = Timber::context();
// Add WooCommerce-specific data to context
$context['checkout'] = WC()->checkout();
// In your theme's functions.php
add_filter('timber/twig', function($twig) {
$twig->addFunction(new \Twig\TwigFunction('WC', function() {
return WC();
}));
return $twig;
});
// Render the Twig template
Timber::render('shop/checkout.twig', $context);
Loading…
Cancel
Save