Using Datafeedr for Dropshipping
Datafeedr, as you probably know, is excellent for building affiliate stores.
They are connected to the datafeeds of all the big affiliate networks and their merchants so they give you access to tons of information.
The equivalent does not yet exist for dropshipping.
What is Dropshipping?
Drop-shipping is where a customer places an order with you, they pay YOU, and then you place the order with the supplier on their behalf and they send the customer the products they ordered.
This is different from affiliate stores in a few ways:
- You take the payment, not the affiliate, so you can charge what you like
- The customers relationship is with you, meaning there’s potential for more sales down the line
- You have the added burden of supporting your customers
- You don’t need to store any stock since you only place orders when the customer places them
How Can Datafeedr be used for Dropshipping?
Straight out of the box, Datafeedr can’t be used for dropshipping. But, at the request of a client, I’ve developed a plugin for drop-shipping which I’m now able to share with everyone. Since Datafeedr connects to ANY affiliate, you have to be careful to ensure you only use suppliers which support dropshipping – this is a manual process I’m afraid as the affiliate networks don’t store any of that kind of information, so Datafeedr has no access to it.
Datafeedr Dropshipping Plugin
The plugin I’ve created works as follows:
- If the country of the user is supported (you configure this), then display a Paypal Buy Now button
- If the country of the user is NOT supported, continue with the usual affiliate links
- When the price is calculated, if it’s a country you’re dropshipping to, the plugin will add whatever markup you decide to the price so you can make some nice profit
Installing the Dropshipping Plugin
The first part of the installation is straight forward enough and follows the normal process of installing plugins to WordPress from a ZIP file (either directly, or using FTP). Follow that process and then activate the plugin.
Download the plugin from this location:
[level-premium]
Datafeedr Dropshipping Plugin
[/level-premium]
Now there will be a widget available in Appearance -> Widgets in your WordPress Admin area.
Add the ‘DFR Dropshipping Country Selector’ to somewhere on your menu so it will be available for use by your Datafeedr store. This country selector is GEOIP enabled, but it does allow users to change the country they’re ordering for if they wish (this is also very useful for testing).
Now you need to configure some settings in the plugin, so go to Settings -> Datafeedr DropShipping and fill in the values:
- Site Wide Markup: Enter a value like 1.2 to add 20% to all the prices. This works site-wide, whenever drop shipping is enabled for that country. You can override this on a per-category basis.
- Accepted Countries: Enter a comma separated list of all the countries you wish to accept for drop shipping. This uses 2-digit ISO codes.
- Paypal Button Code: This is where you enter your Paypal button code – I explain obtaining this in more depth below
Getting the Paypal Button Code
Sign in to your Paypal account and find the ‘Merchant Tools’ area and get to the part where it lets you ‘Create a button’.
Follow the process as if you were doing this normally, except:
- When you find the question ‘Let Paypal Host this button’ – ensure it is NOT selected, Paypal can’t host this button for this plugin to work. There are implications of this as you’ll see later.
- When you find the question about encrypting the button – ensure it is NOT selected.
Once you’ve got the button code, copy and paste it into the box, replacing the relevant parts with the {placeholders} – e.g.
<input type="hidden" name="item_name" value="{productname}"> <input type="hidden" name="amount" value="{productprice}"> <input type="hidden" name="currency_code" value="{productcurrency}">
Integrating the Plugin into the Datafeedr Templates
Unfortunately, Datafeedr does not yet include filters or actions for developers like me to work with, so this is a little more complicated than it should be.
You have to find every location of [product.price] in your Datafeedr templates and replace them with:
<?php echo awd_dropshipprice($product->price); ?>
You then to have to find every location of the BUY buttons and replace THAT code too.
Replace Buy Buttons in default Datafeedr Template
Find this code:
<div class="prc">[product.currency mode="sign"][product.price]</div> <div class="btns"> <a href="[product.url]" class="dfbutton dforange dflarge" title="Buy this product" target="_blank" rel="nofollow">Buy</a> </div>
and replace it with this code:
<?php if (awd_isdropshippingvalid()) { ?> <div class="prc">[product.currency mode="sign"]<?php echo awd_dropshipprice($product->price); ?></div> <?php echo awd_dropshippaypalbutton($product->name, $product->price, $product->currency); } else { ?> <div class="prc">[product.currency mode="sign"][product.price]</div> <div class="btns"> <a href="[product.url]" class="dfbutton dforange dflarge" title="Buy this product" target="_blank" rel="nofollow">Buy</a> </div> <?php } ?>
Replace Buy Buttons using Affilate Web Designers Template
If you are using OUR buy-button styles, then look for the following:
<div class="awdbuybutton"><a href="[product.url]" rel="nofollow external" class="btn" target="_blank">Buy Now</a></div>
And replace it with:
<?php if (awd_isdropshippingvalid()) { ?> <?php echo awd_dropshippaypalbutton($product->name, $product->price, $product->currency); } else { ?> <div class="awdbuybutton"><a href="[product.url]" rel="nofollow external" class="btn" target="_blank">Buy Now</a></div> <?php } ?>
Once complete, go back to your WordPress admin interface and go to Tools->Datafeedr and select ‘Update Settings’.
Test it out
Visit your site, and visit a page that contains the BUY button and some prices.
Change the country using the Country Selector to a country that you have set up to accept drop-shipping and confirm the following:
- The price increases to reflect the markup you are adding
- The BUY button changes into a Paypal Buy Now button
Troubleshooting
Be careful that you don’t have page level caching enabled as that will screw up this plugin. If someone from Canada loads the page first, and you have dropshipping enabled only for the United States, then the Canadian, by accessing the page first, will set the button to be an affiliate buy button rather than a Paypal dropshipping button.
Object level caching will continue to work fine, just page level caching won’t work.
Potential Upgrades
There is more that could be done with this plugin:
- Use AddToCart button instead of BuyNow – I actually think this would work right now, someone needs to test it
- Variable shipping rates per country – Paypal lets you set a flat shipping rate – it would be nice to adjust the shipping rates based on the quantity of products ordered and the country they are ordering from
- Add some code to allow page-level caching to work – I could modify the plugin so that when it detects the country of the user it automatically redirects to ?usercountry=US. This would keep all the individual pages per country unique in the page-level cache meaning page-level caching would continue to work. This would still work for Facebook shares, G+ shares and Tweets (i.e. counts would be across all pages) although I think LinkedIn would maintain individual page level counts (there must be something can be done to fix that though).
If you have any other ideas for how this plugin could be improved, use the comments form below or contact me through the contact page or find me on the Datafeedr forums.
Latest posts by dhilditch (see all)- How to create a tree of categories from a custom taxonomy - September 22, 2014
- Managing postcodes and locations with WPAllImport - September 22, 2014
- Why do affiliate merchants reject your website? - August 20, 2014
January 24, 2017 @ 8:48 pm
Will this plugin work wth WP 4.7.1?
February 19, 2017 @ 5:58 pm
Yes it works with the latest WordPress