Skip to content

Instantly share code, notes, and snippets.

View ali-cedcoss's full-sized avatar

Ali Rizvi - 1266 ali-cedcoss

View GitHub Profile
@ali-cedcoss
ali-cedcoss / code.md
Last active March 21, 2022 14:38
updating SKUs on ebay
elseif ( 'update_sku' == $operation ) {
					$prodIDs          = $product_id[0];
					$already_uploaded = get_post_meta( $prodIDs, '_ced_ebay_listing_id_' . $user_id, true );
					$product = wc_get_product($prodIDs);
					$product_type = $product->get_type();
					if('variable' == $product_type){
						echo json_encode(
@ali-cedcoss
ali-cedcoss / code.md
Last active March 9, 2022 11:41
prevent importing products of certain ebay category
$fileCategory = CED_EBAY_DIRPATH . 'admin/ebay/lib/cedGetcategories.php';
		if ( file_exists( $fileCategory ) ) {
			require_once $fileCategory;
		}

if(!empty($itemDetails['Item']['PrimaryCategory']['CategoryID'])){
						$cedCatInstance = CedGetCategories::get_instance( $siteID, $token );
@ali-cedcoss
ali-cedcoss / code.md
Last active March 3, 2022 13:27
fixing SKU Mismatch for variable products on ebay
### class-ebay.php
public function prepareProductHtmlForUpdateStock( $proIDs = array(), $userId, $notAjax = false ) {
			if ( ! is_array( $proIDs ) ) {
				$proIDs = array( $proIDs );
			}

			$shop_data = ced_ebay_get_shop_data( $userId );
@ali-cedcoss
ali-cedcoss / code.md
Last active April 21, 2022 16:12
get ebay products for specified days
		$user_id = 'nextdaykoi';
		require_once CED_EBAY_DIRPATH . 'admin/ebay/lib/ebayUpload.php';
		$shop_data = ced_ebay_get_shop_data( $user_id );
		if ( ! empty( $shop_data ) ) {
			$siteID      = $shop_data['siteID'];
			$token       = $shop_data['token']['eBayAuthToken'];
			$getLocation = $shop_data['Location'];
		}
@ali-cedcoss
ali-cedcoss / code.md
Created January 28, 2022 05:05
ebay VAT rate for shipping amount

code goes in the create_order function in eBayOrders.php

$taxes = WC_Tax::get_rates_for_tax_class( '' );

            $all_tax_rates = [];
            $tax_classes = WC_Tax::get_tax_classes(); // Retrieve all tax classes.
@ali-cedcoss
ali-cedcoss / code.md
Created January 17, 2022 17:05
multi-level store cat mapping
##category-mapping-view.php



<?php

// If this file is called directly, abort.
@ali-cedcoss
ali-cedcoss / code.md
Last active December 28, 2021 08:12
async inventory update
### settings-view.php code changes

if ( isset( $_POST['ced_ebay_setting_nonce'] ) && wp_verify_nonce( sanitize_text_field( $_POST['ced_ebay_setting_nonce'] ), 'ced_ebay_setting_page_nonce' ) ) {
	if ( isset( $_POST['global_settings'] ) ) {
		$settings             = array();
		$sanitized_array      = filter_input_array( INPUT_POST, FILTER_SANITIZE_STRING );
		$settings             = get_option( 'ced_ebay_global_settings', array() );
		$settings[ $user_id ] = isset( $sanitized_array['ced_ebay_global_settings'] ) ? ( $sanitized_array['ced_ebay_global_settings'] ) : array();
@ali-cedcoss
ali-cedcoss / code.md
Last active May 11, 2022 10:24
async listing import
### Change the USER ID

add_action('wp_ajax_nopriv_ced_ebay_import_products_async_endpoint', array($this, 'ced_ebay_import_products_async_endpoint'));
			add_action('ced_ebay_import_products_async_action', array($this, 'ced_ebay_import_products_async_method'));

            public function ced_ebay_import_products_async_method($ebay_item){
		if(!empty($ebay_item)){
			$logger   = wc_get_logger();
@ali-cedcoss
ali-cedcoss / code.md
Last active December 12, 2021 12:11
ebay subscribing to notification
	add_action('wp_ajax_ced_ebay_notification_endpoint', array($this, 'ced_ebay_notification_endpoint'));
		add_action('wp_ajax_nopriv_ced_ebay_notification_endpoint', array($this, 'ced_ebay_notification_endpoint'));
			add_action('ced_ebay_item_revised_async_action', array($this, 'ced_ebay_process_item_revised_notification'));
		add_action('ced_ebay_item_listed_async_action', array($this, 'ced_ebay_process_item_listed_notification'));
		add_action('ced_ebay_order_placed_notification_async_action', array($this, 'ced_ebay_process_order_placed_notification'));

### GETTING NOTIFICATION PREFERENCES
@ali-cedcoss
ali-cedcoss / code.md
Last active March 4, 2022 14:52
mark fulfilled orders on eBay as complete on woo.
		//refunded orders on eBay will be cancelled and refunded on woo as well along with order fulfillment from eBay to Woo.


		add_action('wp_ajax_nopriv_ced_ebay_fetch_order_status_from_ebay', array($this, 'ced_ebay_fetch_order_status_from_ebay'));



public function ced_ebay_fetch_order_status_from_ebay(){