Home Forums WC Vendors Pro Support Store shipping address differs in front and back office

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.

https://docs.wcvendors.com/

Thank you to all of our customers!

 

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #35525
    Nicolas
    Participant

    Hi

    I’m developing a custom delivery module for WooCommerce Vendors Pro. There is something I don’t understand.

    In the vendor’s dashboard, in the store settings / delivery (file class-wcvendors-pro-vendor-controller.php), it’s possible to set a store delivery address. This one is stored as an array in the meta field _wcv_shipping.

    		if ( $shipping_from && $shipping_from == 'other' ) { 
    
    			$shipping_address = array(
    				'address1' => 	$shipping_address1,
    				'address2' => 	$shipping_address2,
    				'city'	   =>	$shipping_city,
    				'state'    =>	$shipping_state,
    				'country'  => 	$shipping_country,
    				'postcode' => 	$shipping_postcode,
    			); 
    
    			$wcvendors_shipping[ 'shipping_address' ] = $shipping_address; 
    		} 
    
    		update_user_meta( $vendor_id, '_wcv_shipping', 	$wcvendors_shipping ); 	

    In the admin, when editing a vendor (file class-wcvendors-pro-admin-vendor-controller.php) there is also a store delivery address but it’s a different one, using a meta field per address field (i.e. _wcv_shipping_address1, _wcv_shipping_city etc)

    There is no hook/redundancy between those fields, both the admin and the front-end vendor can set a different store shipping address.

    BTW, there is no possibility in the admin controller to set the _wcv_shipping_from meta.
    BTW2, “store state” is using _wcv_shipping_state instead of _wcv_store_state.

    Is it intentional or is it a bug in the admin controller ?

    #35528
    Nicolas
    Participant

    Here is a workaround to this issue using hooks so the original code is not altered: http://pastebin.com/SiMkSnEu

    It uses the _wcv_shipping meta array only which I assume is the right way to do it since it’s in the migration scripts.

    It also fixes the issue with the store address state field and adds the “Shipping From” selector on admin.

    Hope this helps 🙂

    #35551
    WC Vendors Support
    Participant

    Thanks, I’ll pass this to Jamie to check out and see if it’s an oopsie or intentional. 🙂

    #35607
    Jamie
    Keymaster

    Hello,

    Yes this is a bug. I’ll update the admin area stuff to use _wcv_shipping meta key array for the next release.

    cheers,

    Jamie.

    #35709
    Jamie
    Keymaster

    Hello,

    On further inspection the reason why we use individual meta keys is because these are auto populated by the user controller on the backend without the need to query the database separately. These keys are referenced on the front and backend. The only issue is that the admin user area isn’t saving this data to the array for shipping calculations. It would make more sense for me to update the shipping controller to remove this array completely and go back to the individual keys instead. Which is what I will be doing.

    cheers,

    Jamie.

    #35712
    Jamie
    Keymaster

    Hello,

    You can ignore the previous post. I’m redoing the entire shipping admin control on the backend now.

    cheers,

    Jamie.

    #35713
    Nicolas
    Participant

    OK, so if I keep using the data from the _wcv_shipping meta in my shipping module this won’t break anything with your further changes?

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘WC Vendors Pro Support’ is closed to new topics and replies.