WooCommerce Integration (Paid Addon)

Posted in: Modules and Extensions

This integration allows accepting payments for Ad postings using WooCommerce. Using this addon you can configure multiple listing schemes by simply creating multiple WooCommerce products.

In order to activate it, you need to have WooCommerce plugin and WPAdverts WooCommerce Payments add-on installed. If you do not have our WC Payments add-on you can purchase a copy here.

Once you have a copy of WC Payments (this should be a zip file), you can install and activate it on your site from wp-admin / Plugins / Add New / Upload panel.

Configuration

Once enabled you can go into Module settings panel which will look pretty similar to the one in the screenshot below:

WPAdverts WC configuration page in wp-admin / Classifieds / Options / WooCommerce Payments panel.

The module has few options only and you actually need t fill them only if the first checkbox is checked.

  • Default Pricing – allows selecting a default pricing selected in [adverts_add] form. In order to select default pricing you need to first create some Adverts Listing products (see “Creating Listing Types” section in this article for more details).
  • Default Renewal Pricing – the same as above but for Ad renewals in [adverts_manage] shortcode.
  • Hold For Moderation – (not visible in the screenshot) Here you can select which Ads should be put into moderation. There are 6 checkboxes, 3 for new postings and 3 for renewals. In each group, there is an option to enable moderation for free ads (that is for listing types which price is equal to 0), paid (listing types which will redirect the user to checkout), package (when posting using previously purchased package).
  • Manage – checking this checkbox will show “My Ads” link in the WooCommerce menu in the [woocommerce_my_account] shortcode.  When user will click on this link he will basically see [adverts_manage] shortcode inside WC user panel.
  • ‘My Ads’ Panel Title – allows selecting title visible in WCmy account shortcode (by default it is ‘My Ads’).
  • ‘My Ads’ Panel Slug – allows selecting slug (part of URL) for this panel (by default it is ‘my-ads’).
  • Packages – checking this checkbox will show “My Packages” link in the WooCommerce menu in the [woocommerce_my_account] shortcode.
  • ‘My Packages’ Panel Title – allows selecting title visible in WC my account shortcode (by default ‘My Packages’).
  • ‘My Packages’ Panel Slug – allows selecting slug (part of URL) for this panel (by default it is ‘my-packages’).

Creating Listing Types

Using the WC integration comes down to creating some WC Products. Go to wp-admin / Products / Add New panel, enter product Title and optionally a description. Now in Product Data – Product Type dropdown select “Single Listing (WPAdverts)” or since version 1.2.0 “Renew Listing (WPAdverts)” – what is the difference?

Single Listings can be used to post new Ads usually using [adverts_add] shortcode, the Renew Listings can be used to renew existing listings. If you have at least one Renew Listing product configured then in [adverts_manage] panel users will find a “Renew Ad” button which they can use to renew their Ad.

Selecting Single Listing or Renew Listing in Product Data drop-down will do a couple of things:

  • WPAdverts will know that this product is a Listing Type (and will be able to display it in Post an Ad Form or the Manage Adverts shortcode.)
  • You will be able to enter Ad Duration that is how long (in days) Ad should be displayed and turn on Feature ad listing checkbox, checking it will display the ad above other listings and with a different background.
  • Since version 1.3.0, there is an additional  Number of listings field. Entering a value greater than 1 will create a package. For example, if you will enter there 3 then when posting first Ad user will have to pay for the posting but next 2 ads he will be able to post without paying (using the purchased package).

 

Create a WooCommerce Classified Pricing Product

When you enter required data and save the product, it will display in [adverts_add] or [adverts_manage] if the product is published and visible.

Using Listing Types

Posting a New Ad – when posting and Ad users will see in Listing Information group in the [adverts_add] form, from there users will be able to select from previously created WooCommerce Products (of course only from those that have “Single Listing (WPAdverts)” selected as product type.

Post a classified and pay using WooCommerce product or package.

In the image above you can see how the pricings are listed in the [adverts_add] form. They are grouped into packages and single postings. Additionally, the MultiPack is selected by default because in the configuration it was set as a default Pricing.

Note the user has MultiPack package active, therefore on the right side instead of the price a number of listings left is displayed.

If a user will select one of the products which price is higher than 0.00 and in preview clicks “Publish Listing” button, his product will be added to cart and user will be redirected to WooCommerce checkout page.

Renewing an Advert – in the [adverts_manage] panel after clicking the “More” button, a “Renew Ad” button will show if you have at least one Renew Listing created and published.

After clicking the Renew Ad button you will be asked to select renewal type and submit the form, if the price of renewal is greater than 0.00 user will be redirected to WooCommerce checkout page.

Pro Tip: It is possible to have free renewals if you set product price to 0.00, however if a user will select this renewal type, then his Ad will be automatically renewed, but the expiration date will be set to Today + Duration set in product configuration, this is configured like that to avoid users abusing the free renewals. In other words, if you have a free renewal with the duration set to 7 days, then renewing multiple times will still set the expiration date to Today + 7 days.

Buying Packages Separately

You can allow users to purchase the packages from your WooCommerce store separately. Once user will do that he can go to a page with [adverts_add] shortcode and use the previously purchased package.

Important Note. The packages are available to logged in users. If a logged out user will try to post an Advert from [adverts_add] page he will be automatically registered even if he did not checked the “Create account for me …” checkbox in the [adverts_add] form.

Managing packages in the front-end

From WooCommerce My Account page users can manage their purchased Ads and packages.

WooCommerce My Account with ‘My Ads’ and ‘My Packages’ links.

One the image above you can see the WooCommerce My Account page. Note, in the left menu there are My Ads and My Packages links configured at the beginning of this article.

The main content of this article shows a list of purchased packages. If you will click on the “Details” button it will show the Package details like on the image below

Viewing package details from WooCommerce My Account page.

The details include package ID, the date when it was purchased and a maximum number of postings. If the package was already used the in “Package Usage” section you will also see for which postings the package was used.

Managing Paid Ads in wp-admin Panel

All Ads for which payments have not been finished for some reason, are displayed with “Pending Payment” state and link back to Order (as on the screenshot below), alternatively if user will not create WC order or the order will be deleted by Administrator the Ad will display with Abandoned state, which means that user cannot finish payment.

wc-pending-listing

Managing Packages in wp-admin panel

From wp-admin / Classifieds / Packages panel the Administrator can edit and delete the purchased packages.

Managing purchased packages from wp-admin / Classifieds / Packages panel.

The packages can be sorted by User who purchased them, by purchased product and by purchase date. Clicking a link in order column will redirect the user to a WooCommerce order associated with this package.

On the right side of the list, you can see Used and Limit columns. They will tell you how many times the package was already used and what is the maximum number of times the package can be used.

To change the package details or see on which Ads the package was used click on the link in Package Title column it will take you to a page like the one below

Edit purchased WooCommerce package from wp-admin / Classifieds / Packages panel.

Pricing Per Listing Type

Using Custom Fields extension and the WooCommerce integration you can build multiple variations of the [adverts_add] form and assign a different pricing to each form variation.

This gives you an opportunity to charge users more for additional features. For example, you can offer

  • Basic Listing Type with short description an no image uploads.
  • Premium Listing Type with long descriptions and 10 image uploads

The Basic Listing can be free while the Premium Listing would require a payment as the user can enter more details and his listing is more likely to sell.

How to set up this functionality you can find out in Pricing Per Feature documentation.

Troubleshooting

If you wish to use WooCommerce integration make sure you have the bundled Payments Module disabled, both WC Integration and Payments Module provide basically the same functionality, so they most probably will be conflicting when enabled at the same time.

Customization

By default the WC integration will allow using only products which are visible in WooCommerce catalog or search, you can change that and show products which are hidden as well by adding the code below to your theme functions.php file

add_filter( "adext_wc_payments_products_new", "show_hidden_wpadverts_products" );
add_filter( "adext_wc_payments_products_renew", "show_hidden_wpadverts_products" );
function show_hidden_wpadverts_products( $args ) {
    $args["meta_query"][0]["value"] = array( "catalog", "search", "hidden" );
    return $args;
}

You can use the above filters to further tune which products can be used by users, the $args is basically a list of arguments that will be passed to get_posts() function.