Snippets

Visser Labs Creating a custom WordPress Plugin to extend Store Exporter Deluxe

Created by Michael Visser

File functions.php Added

  • Ignore whitespace
  • Hide word diff
+<?php
+/*
+Plugin Name: WooCommerce - Store Exporter Deluxe (Custom Add-on)
+Plugin URI: http://www.visser.com.au/woocommerce/plugins/exporter-deluxe/
+Description: Custom Add-on Plugin for Store Exporter Deluxe
+Version: 1.0
+Author: Visser Labs
+Author URI: http://www.visser.com.au/about/
+Text Domain: woocommerce-exporter
+License: GPL2
+
+Text Domain: woocommerce-exporter
+Domain Path: /languages/
+*/
+
+if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
+
+function custom_woo_ce_get_order_items( $order_items, $order_id ) {
+
+	if( !empty( $order_items ) ) {
+		foreach( $order_items as $key => $order_item ) {
+
+			// Check the Product Name for / (forward slash)
+			if( strpos( $order_items[$key]->name, '/' ) !== false ) {
+				$product_name = explode( '/', $order_items[$key]->name );
+				if( !empty( $product_name ) ) {
+					$order_items[$key]->name = trim( $product_name[1] );
+				}
+				unset( $product_name );
+			}
+
+		}
+	}
+	return $order_items;
+
+}
+add_filter( 'woo_ce_get_order_items', 'custom_woo_ce_get_order_items', 10, 2 );
+?>