WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
Integrate WooCommerce with product warehouse via REST (8 posts)

  1. expertwebteam
    Member
    Posted 1 year ago #

    I am building a shopping cart website where an order request will be sent to the product manufacturer, to be shipped to the end customer. They have a REST API which accepts custom XML and I need to integrate with this API to:

    1. Invoke the createOrder url with custom XML containing all form data collected from data is collected from user in cart.

    2. Display a response code to the user based on response from 3rd party API.

    3. Display inventory based on getInventory method of API.

    My question is, does woocommerce have an extensible API, or even a plugin to allow me to add this functionality without being required to modify the core code?

    I looked through the tutorials and did not find anything. If they don't, please let me know best practices so I don't cause future woocommerce upgrades to be painful since I have customized the code.

    Thanks in advance,
    Clint

    http://wordpress.org/extend/plugins/woocommerce/

  2. bheadrick
    Member
    Posted 1 year ago #

    I don't think woocommerce does, but wordpress has an xmlrpc api.

    Products are just a custom post type. Including attributes could get tricky, because they're more than just custom taxonomies - each entry also has an associated serialized postmeta value, but there's nothing about products that you can't import/create using the same method you'd use to create normal posts.

  3. expertwebteam
    Member
    Posted 1 year ago #

    Thanks, can the WordPress xmlrpc api be used seemlessly with woocommerce, where I can send an order request through the xmlrpc API, so that I can display the result in the final page of the checkout process?

  4. bheadrick
    Member
    Posted 1 year ago #

    Not exactly.

    Orders are post-type's too, so you could probably create an order through xmlrpc in theory. Orders are available to logged-in users through the url
    /my-account/view-order/?order=<order#>
    You might be able to use this (the order# is just the post id of the order post)

    I definitely wouldn't use the word "seemless" about any of this. I think you'd need to do quite a bit of coding and reverse engineering to get it to work smoothly.

  5. jrgd
    Member
    Posted 1 year ago #

    i'm stuck on something very similar: creating orders via xmlrpc; all the custom fields starting with an underscore are being silently ignored…

    did you get it working in the end?

  6. dsomar
    Member
    Posted 1 year ago #

    bump

    Anyone ever get this working?

  7. Ojay
    Member
    Posted 1 year ago #

    Yeah I'm in a similar boat... needing to post info to a third party API, in my case registration information... so will have a customised checkout form with a bunch of extra fields, those extra fields need to be submitted to the API after validation of the payment.

    ideally some kind of hook in functions.php that runs after successful payment... I can't find anything in the docs and support request has gone unanswered unfortunately. Anybody know of such a hook??

  8. Ojay
    Member
    Posted 1 year ago #

    Sweet...

    <?php
    add_action( 'woocommerce_order_status_completed', 'my_function' );
    /*
     * Do something after WooCommerce sets an order on completed
     */
    function my_function($order_id) {
    
    	// order object (optional but handy)
    	$order = new WC_Order( $order_id );
    
    	// do some stuff here
    
    }

    So then in your function you could have a variable that is basically xml, echo your content in to that xml and then submit that to the API... or something like that??

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic