HI everyone,
I’m trying to include a blade components on the checkout page through woo hooks (‘woocommerce_checkout_shipping’)
add_action('woocommerce_checkout_shipping', function() {
echo template('components.checkout-shipping-block');
}, 10);
I created a controller for the checkout page (PageCheckout.php) with a cpt query
namespace App\Controllers;
use Sober\Controller\Controller;
class PageCheckout extends Controller
{
public function getPosts()
{
$posts = get_posts(array('post_type' => 'area'));
return array_map(function ($area) {
return [
'id' => $area->ID ?? null,
'slug' => $area->post_name ?? null,
'name' => $area->post_title ?? null,
];
}, $posts ?? []);
}
...
i’m trying to debug the array $get_posts on the components (checkout-shipping-block.blade.php), but the array is empty and got a null response.
what am i missing?