Show listing block on WooCommerce Checkout page by ID

Hi! I want to show listing block on checkout page, which is present in cart. I got this listing object already by this code:

$listing = HivePress\Models\Listing::query()->get_by_id($listing_id);

How may I to render this listing block? The hivepress()->display returns NULL on this page.

I’m sorry for the late reply.

Yes, if you already have a function that injects custom HTML to the WooCommerce checkout page, you can get the listing object via the code you posted. The listing ID is set as post_parent of the purchased product. Then, you can render the listing template, passing the listing object to it’s context. Here’s an example

Hope this helps.

Thanks a lot, it works!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.