WPSyncSheets For Woocommerce

Documentation

WooCommerce Google Spreadsheet Addon

Filters, Hooks & Snippets

Update Synchronization Limit

By default, this plugin has a synchronization limit set to 500 for the total order/product/customer/coupon/event count above 2000.

If you are having an issue related to the limit or you just want to increase or decrease the limit as per your server configuration requirement you can add this filter to your theme’s functions.php file.

To change the order sync limit to 200

function update_sync_limit(){
      return 200;
}
add_filter(  'wpssw_order_sync_limit', 'update_sync_limit' );

To change the product sync limit to 150

function update_sync_limit(){
      return 150;
}
add_filter(  'wpssw_product_sync_limit', 'update_sync_limit' );

To change the coupon sync limit to 100

function update_sync_limit(){
      return 100;
}
add_filter(  'wpssw_coupon_sync_limit', 'update_sync_limit' );

To change the customer sync limit to 200

function update_sync_limit(){
      return 200;
}
add_filter(  'wpssw_customer_sync_limit', 'update_sync_limit' );

To change the event sync limit to 300

function update_sync_limit(){
      return 300;
}
add_filter(  'wpssw_event_sync_limit', 'update_sync_limit' );

How to add your own custom field?

You can add a custom meta key with the prefix ‘wpsyncsheets_’ and our plugin will automatically detect those custom fields and add them to the headers.

// Add a metabox.
add_action( 'add_meta_boxes', 'add_custom_abcd_meta_box' );

function add_custom_abcd_meta_box() {
  
  add_meta_box(
    'custom_meta_box',
    __( 'My Custom Meta Box', 'woocommerce' ),
    'custom_abcd_metabox_content_callback',
    'shop_order'
  );

}

// For displaying metabox content
function custom_abcd_metabox_content_callback( $post ) {
  
  $abcd = get_post_meta( $post->ID, 'wpsyncsheets_abcd', true );

  echo '<p>' . __( 'ABCD', 'woocommerce' ) . '<br>
  <input type="text" style="width:100%" id="abcd" name="abcd" value="' . esc_attr( $abcd ) . '"></p>';

}
// For saving the metabox data.
add_action( 'save_post_shop_order', 'save_custom_abcd_meta_box_data' );

function save_custom_abcd_meta_box_data( $post_id ) {
   
  if ( isset( $_POST['abcd'] ) ) {
      // Update the meta field in the database.
      update_post_meta( $post_id, 'wpsyncsheets_abcd', sanitize_text_field( $_POST['abcd'] ) );
  }

}

Need help?

We're ready to help out & answer questions!