Skip to content

JetEngine extra Macros

Soczó edited this page Nov 2, 2024 · 9 revisions

WC Current User Purchased Products

Returns the ID of the products that the currently logged in user has purchased. Only calculates from completed orders. (With comma separation.)

Use in the Query Builder: Create a new Query in the Query builder. The Query Type should be Wc Product Query. In the general section, in Includes, select this macro: WC Current User Purchased Products

image


WC Loop Products

A single macro that completely covers product listing (archive type) using Query Builder. With this macro, the listing grid, 8or any widget with a query builder query), when placed on the shop page (template) or on the archive page, will display the products accordingly.

The Query Type set to WC Product Query. In the general section navigate the Include section, and use the WC Loop Products macro

image


WC Membership Access Posts

(Only if you have Woo Membership plugin installed) https://woo.com/products/woocommerce-memberships/ Returns the ID of the posts to which the user has access. These are retrieved via the Woo Membership API. (With comma separation.)

Use in the Query Builder: Create a new Query in the Query builder. The Query Type should be Post Query. Navigate to the Post & Page section. In the Post In input, select this macro: WC Membership Access Posts In this Macro, you have to choose from which Membership you want the user to retrieve the available posts. image


WC Current User Active Memberships

(Only if you have Woo Membership plugin installed)

Returns the membership plans of the currently logged in user. You can choose to include all or a specific status. It will only not add plans that it does not have. If you choose Any status it doesn't matter if it's expired or suspended, it will return the ID.

How to use and combine with the Query builder and listing grid?

  • 1, Create a new Query. Query type: Post
  • 2, In the general section Post type selection choose Members (this is the name of one of woocommerce's membership CPTs.)
  • 3, In the general section, Post status select: Any. (Since there are special statuses here, the macro will filter it.)
  • 4, In the Post & page section the Post In input select the WC Current User Active Memberships macro, and choose the membership status.
  • 5, Done!

image image


How to build a listing with the memberhsip with current user membership details

Go to the JetEngine Listing - and create a new listing, you can use for the source Post, or Query builder (With the previously created Query with query builder.) It's funny, because actually whatever you choose the data comes out fine, the preview can be a problem, but it's safest either if the source is the query builder, but if post then Members (as set in the query builder)

image You may not see some data correctly in the preview, but don't be scared. To retrieve the data, use the Current membership Data dynamic tag.

image The data that can be retrieved using the dynamic tag: Plan name, Next bill (if use subscriptions), status, member since, Expires, remaning time

If you want to hide a piece of data from the current membership data when the memberhsip has expired, you can use our extra jetengine dynamic visibility condition : Current Membership Expired


Learndash Specific Macros

Using the following macros in Query Builder is the most recommended, but does not exclude other options.

  • LD User Courses
  • LD Course Access Type Query
  • LD Course Prerequisites Query
  • LD User Groups

LD User Courses

In the query builder, set the post type to course, then navigate to the Post & Page section. For the Post in option, click on the dynamic label and select LD User Courses macro from the list. image

What is important to know is that it always tries to retrieve courses related to the current user. In the extra select field, you can choose to list all the ones it has, only the ones it has in progress (i.e. not yet completed), or only the ones it has completed.


LD Course Access Type Query

In the query builder, set the post type to course, then navigate to the Post & Page section. For the Post in option, click on the dynamic label and select LD Course Access Type Query macro from the list.

Here you can query for courses by access type(s). You can also use the jetsmartfilter + Query Builder combination to create your own filter with the access types.


LD Course Prerequisites Query

In the query builder, set the post type to course, then navigate to the Post & Page section. For the Post in option, click on the dynamic label and select LD Course Prerequisites Query macro from the list.

This is very interesting. If you place the display, for example the lisitng grid on the course single page, and if you have a prerequisite set for the add course (you need to complete one of the courses), it will list them (you can also retrieve this with a dynamic tag)


LD User Groups

In the query builder, set the post type to course, then navigate to the Post & Page section. For the Post in option, click on the dynamic label and select LD User Groups macro from the list.

This macro returns all the groups the current user has accessed, enrolled in.

Clone this wiki locally