Hi guys! bricks/render-elements has become our main verification step after writing elements. It returns the saved tree’s HTML and CSS without page cache and without an HTTP round trip, which is great.
The one area it can’t cover is WooCommerce cart and checkout. With no session cart, rendering the checkout page returns about 288 bytes: the v2 wrapper and nothing else. So after editing a cart or checkout template we still drop into execute-php to build a temporary cart (wc_load_cart(), add_to_cart(), set customer country, calculate_totals()), then call Frontend::render_element() by hand. That covers things like checking shipping labels, fee rows and form fields.
Environment: Bricks 2.4.4, WooCommerce 11.2.1.
Request: an optional wooContext input on render-elements, used only for that render and discarded afterwards:
{
"postId": 123,
"wooContext": {
"cart": [{"productId": 20, "quantity": 1}],
"customer": {"country": "HU", "postcode": "1011"},
"chosenShippingMethod": "flat_rate:1",
"chosenPaymentMethod": "cod",
"coupons": ["TEST10"]
}
}
That would make cart and checkout changes verifiable in one call, the same way every other template already is, without requiring execute-php.