I tried to parse information using services, but they do not collect all the necessary information. Specifically, I need a product ID; Subsequently, when buying a product on the Woocommerce website, I will need to create an order on the Presta by API website using the product ID.
This is dropshipping
I tried to parse information using services, but they do not collect all the necessary information. Specifically, I need a product ID; Subsequently, when buying a product on the Woocommerce website, I will need to create an order on the Presta by API website using the product ID.
This is dropshipping
Thank you very much for the instruction. But I did not understand a little how to refer to the desired product. That is, when a user on the woocommerce site buys a product, the order should be automatically purchased by me on the supplier's(presta) site. How to do it?
Put PSWebServiceLibrary.php at the root of your web server, and add this line at the beginning of any PHP file that needs to use your store's webservice.
Then, you must create an instance of the PrestaShopWebservice object, which takes 3 parameters in its constructor:
The store's root path (ex: http://example.com/ ).
The authentication key (ex: UCCLLQ9N2ARSHWCXLT74KUKSSK34BFKX).
A boolean value, indicating whether the webservice must use its debug mode.
Here's how you create a webservice call:
$webService = new PrestaShopWebservice('http://example.com/', 'UCCLLQ9N2ARSHWCXLT74KUKSSK34BFKX', false);
. Use hook of order confirmation in WordPress that named "woocommerce_thankyou"
// add classes to work with API
require_once(__ROOT__.'/PrestaShopWebservice.php');
$webService = new PrestaShopWebservice('http://your.site/', 'UCCLLQ9N2ARSHWCXLT74KUKSSK34BFKX', false);
add_action('woocommerce_thankyou', 'enroll_student', 10, 1);
function enroll_student( $order_id ) {
if ( ! $order_id )
return;
// Allow code execution only once
if( ! get_post_meta( $order_id, '_thankyou_action_done', true ) ) {
// Get an instance of the WC_Order object
$order = wc_get_order( $order_id );
// Get the order key
$order_key = $order->get_order_key();
// Get the order number
$order_key = $order->get_order_number();
Thanks!
I am able to create a shopping cart, but when creating an order, I get a fatal error. All required fields are filled in, I cannot understand what the problem is.
Thanks!
I am able to create a shopping cart, but when creating an order, I get a fatal error. All required fields are filled in, I cannot understand what the problem is.
Maybe it is on Presta side. Perhaps overrides in Classes. Testing you code. Create subdomain on your hosting. Install PS version of PS on other site and with demo data. Test you code. But first ask owner of Prestashop regarding folder "override". Ask of archive of folder in question.