Importing Price Comparison URLs

You can either manually enter the relevant URLs for each product or you can automate this process. If you have a large number of products, it makes sense to automate it.

Note: Price Comparison Pro will automatically use URLs in your WooCommerce External/Affiliate products if you already have them configured. This guide helps you add additional URLs for comparison purposes.

The means of automating varies depending on how you are sourcing your products – ultimately, you need to enter the Price Comparison Pro URLs into the following product meta data:

  • producturl1, producturl2 etc (up to 10)
  • pcproaffiliateurl1, pcproaffiliateurl2 etc (up to 10)

PHP Code to set these URLs

If you are using WP All Import, it allows you to call PHP functions for items you are importing. So, if you have additional URLs in your feed, you can use the provided function below to set these up.

Here are the internals of a function that you can use (you don’t need to define this function, it comes with Price Comparison Pro):

function setPriceComparisonProURLs($post_id, $comparisonindex, $directurl, $affiliateurl) {
update_post_meta( $post_id, 'producturl' . $comparisonindex, esc_attr( $directurl ) );
update_post_meta( $post_id, 'pcproaffiliateurl' . $comparisonindex, esc_attr( $affiliateurl ) );
}

That means you can call this function above with the post_id, the index (starts at 1, up to 10), the direct product url and the affiliate url inside your import job.

If you need help with this, let us know. We want to ideally automate this as far as possible for people – perhaps by de-duplicating existing products in your site based on the SKU. Before I code that up, I’d like to know what other techniques people are using and what would work best.

Be the first to comment and we'll reply right away.

Leave a reply

Super Speedy Plugins
Logo