Warning: A non-numeric value encountered in /home/simpliko/wpadverts.com/public_html/wp-content/themes/Divi/functions.php on line 5806

The WooCommerce Classifieds Integration (v1.6) was just released and you should see an update notification in your wp-admin panel.

If it will not appear within 24 hours, go to wp-admin / Dashboard / Updates panel and click the “Check Again” button it should show then.

This is a major update and aside from some bug fixes and small improvements it has a couple of “big” new features.

Purchase Pricings Individually

If your Advert pricings in wp-admin / Products panel are visible to users then from now on the user will be able to purchase like any other WooCommerce product.

Once purchased and paid in the [adverts_add] shortcode the pricings will not show a price but a number of times the pricing can be used (the number will, of course, depend on how many times the product was purchased and purchase quantity).

It will look like on the image below

The user purchased a “Featured Ad” posting and can now use it without paying.

For now, this feature will work only for logged in users as when buying the product while logged out it is not possible to assign the purchased pricing with a user posting from the page with [adverts_add].

By default, the users can purchase only one item of type “advert_single” or “advert_renew” per order. If you would like to allow purchasing multiple products add in your theme functions.php the code below

add_filter( 'wcpl_advert_single_is_sold_individually', '__return_false' );
add_filter( 'wcpl_advert_renew_is_sold_individually', '__return_false' );

Connecting classified ads with orders and packages

In the earlier versions in wp-admin / Classifieds panel the order icon was shown next to Ad title only while the payment was pending.

With the new update, the icon will be visible as long as the order exists in wp-admin / WooCommerce / Orders panel.

Additionally, there is a new “package” icon which allows checking which package was used when creating the Advert.

Order and Package links are being used to identify how the user paid for the posting.

These update mainly makes it easier to check how the user “paid” (either with cash or pre-purchased package) for the posted Advert.

Bug Fixes and Improvements

The “Complete Payment” button was not visible in [adverts_manage] until at least one Advert Renew product was created in wp-admin / Products panel.

The Advert is featured once only when “paying” for an Advert using a Package (which should always post featured Ads).

When deleting an Ad posted using the package credits the credits reset. That is if a user has 10 items left and he will post an Ad (there will be 9 items left) and then the Ad is deleted by the user the count will change back to 10. In the new WPAdverts release the credits are not reset after Ad deletion.

Finally, there were multiple updates “under the hood” to make the WooCommerce Integration compatible with the upcoming Memberships extension.

The outstanding issue for version 1.6.1.

One issue that was not resolved because it turned out to be more complex (in terms of possible use cases) than we anticipated is registering the user while posting from [adverts_add].

The current problem is that if the user will be registered from [adverts_add] (because he checked the “Account” checkbox), and registering from WC checkout is enabled then the user would need to create a second account.

The best solution right now is to just login the user automatically after registering from the [adverts_add].

To do that just add the code below in your theme functions.php file

add_filter( "adverts_create_user_from_post_id", "auto_login_user", 1000 );
function auto_login_user( $user_id ) {
	wp_set_auth_cookie( $user_id, false, "");
    $user = get_user_by( "id", $user_id );
	do_action( 'wp_login', $user->user_login, $user );
    return $user_id;
}

Please note that this code is needed only if you allow registering from both [adverts_add] and WC checkout, in other cases you should not need it at all.