mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
⚡ Small improvements on WooCommerce-Node
This commit is contained in:
parent
e1f5a3a067
commit
314625ed5a
|
@ -19,9 +19,9 @@ export const productOperations = [
|
||||||
description: 'Create a product',
|
description: 'Create a product',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Update',
|
name: 'Delete',
|
||||||
value: 'update',
|
value: 'delete',
|
||||||
description: 'Update a product',
|
description: 'Delete a product',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Get',
|
name: 'Get',
|
||||||
|
@ -34,9 +34,9 @@ export const productOperations = [
|
||||||
description: 'Get all products',
|
description: 'Get all products',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Delete',
|
name: 'Update',
|
||||||
value: 'delete',
|
value: 'update',
|
||||||
description: 'Delete a product',
|
description: 'Update a product',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
default: 'create',
|
default: 'create',
|
||||||
|
@ -117,21 +117,21 @@ export const productFields = [
|
||||||
name: 'catalogVisibility',
|
name: 'catalogVisibility',
|
||||||
type: 'options',
|
type: 'options',
|
||||||
options: [
|
options: [
|
||||||
{
|
|
||||||
name: 'Visible',
|
|
||||||
value: 'visible',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'Catalog',
|
name: 'Catalog',
|
||||||
value: 'catalog',
|
value: 'catalog',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Hidden',
|
||||||
|
value: 'hidden',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'Search',
|
name: 'Search',
|
||||||
value: 'search',
|
value: 'search',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Hidden',
|
name: 'Visible',
|
||||||
value: 'hidden',
|
value: 'visible',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
default: 'visible',
|
default: 'visible',
|
||||||
|
@ -220,13 +220,6 @@ export const productFields = [
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Product parent ID.',
|
description: 'Product parent ID.',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
displayName: 'Price',
|
|
||||||
name: 'price',
|
|
||||||
type: 'string',
|
|
||||||
default: '',
|
|
||||||
description: 'Current product price.',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
displayName: 'Purchase Note',
|
displayName: 'Purchase Note',
|
||||||
name: 'purchaseNote',
|
name: 'purchaseNote',
|
||||||
|
@ -752,13 +745,6 @@ export const productFields = [
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Product parent ID.',
|
description: 'Product parent ID.',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
displayName: 'Price',
|
|
||||||
name: 'price',
|
|
||||||
type: 'string',
|
|
||||||
default: '',
|
|
||||||
description: 'Current product price.',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
displayName: 'Purchase Note',
|
displayName: 'Purchase Note',
|
||||||
name: 'purchaseNote',
|
name: 'purchaseNote',
|
||||||
|
@ -1251,13 +1237,6 @@ export const productFields = [
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Limit result set to products based on a minimum price.',
|
description: 'Limit result set to products based on a minimum price.',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
displayName: 'On Sale',
|
|
||||||
name: 'onSale',
|
|
||||||
type: 'boolean',
|
|
||||||
default: false,
|
|
||||||
description: 'Limit result set to products on sale.',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
displayName: 'Order',
|
displayName: 'Order',
|
||||||
name: 'order',
|
name: 'order',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { IDataObject } from "n8n-workflow";
|
import { IDataObject } from 'n8n-workflow';
|
||||||
|
|
||||||
export interface IDimension {
|
export interface IDimension {
|
||||||
height?: string;
|
height?: string;
|
||||||
|
|
|
@ -124,7 +124,7 @@ export class WooCommerce implements INodeType {
|
||||||
body.catalog_visibility = additionalFields.catalogVisibility as string;
|
body.catalog_visibility = additionalFields.catalogVisibility as string;
|
||||||
}
|
}
|
||||||
if (additionalFields.categories) {
|
if (additionalFields.categories) {
|
||||||
body.categories = (additionalFields.categories as string[]).map(category => { id: parseInt(category, 10); }) as unknown as IDataObject[];
|
body.categories = (additionalFields.categories as string[]).map(category => ({ id: parseInt(category, 10) })) as unknown as IDataObject[];
|
||||||
}
|
}
|
||||||
if (additionalFields.crossSellIds) {
|
if (additionalFields.crossSellIds) {
|
||||||
body.cross_sell_ids = (additionalFields.crossSellIds as string).split(',') as string[];
|
body.cross_sell_ids = (additionalFields.crossSellIds as string).split(',') as string[];
|
||||||
|
@ -153,9 +153,6 @@ export class WooCommerce implements INodeType {
|
||||||
if (additionalFields.parentId) {
|
if (additionalFields.parentId) {
|
||||||
body.parent_id = additionalFields.parentId as string;
|
body.parent_id = additionalFields.parentId as string;
|
||||||
}
|
}
|
||||||
if (additionalFields.price) {
|
|
||||||
body.price = additionalFields.price as string;
|
|
||||||
}
|
|
||||||
if (additionalFields.purchaseNote) {
|
if (additionalFields.purchaseNote) {
|
||||||
body.purchase_note = additionalFields.purchaseNote as string;
|
body.purchase_note = additionalFields.purchaseNote as string;
|
||||||
}
|
}
|
||||||
|
@ -193,7 +190,7 @@ export class WooCommerce implements INodeType {
|
||||||
body.stock_status = additionalFields.stockStatus as string;
|
body.stock_status = additionalFields.stockStatus as string;
|
||||||
}
|
}
|
||||||
if (additionalFields.tags) {
|
if (additionalFields.tags) {
|
||||||
body.tags = (additionalFields.tags as string[]).map(tag => { id: parseInt(tag, 10); }) as unknown as IDataObject[];
|
body.tags = (additionalFields.tags as string[]).map(tag => ({ 'id': parseInt(tag, 10) })) as unknown as IDataObject[];
|
||||||
}
|
}
|
||||||
if (additionalFields.taxClass) {
|
if (additionalFields.taxClass) {
|
||||||
body.tax_class = additionalFields.taxClass as string;
|
body.tax_class = additionalFields.taxClass as string;
|
||||||
|
@ -245,7 +242,7 @@ export class WooCommerce implements INodeType {
|
||||||
body.catalog_visibility = updateFields.catalogVisibility as string;
|
body.catalog_visibility = updateFields.catalogVisibility as string;
|
||||||
}
|
}
|
||||||
if (updateFields.categories) {
|
if (updateFields.categories) {
|
||||||
body.categories = (updateFields.categories as string[]).map(category => { id: parseInt(category, 10); }) as unknown as IDataObject[];
|
body.categories = (updateFields.categories as string[]).map(category => ({ id: parseInt(category, 10) })) as unknown as IDataObject[];
|
||||||
}
|
}
|
||||||
if (updateFields.crossSellIds) {
|
if (updateFields.crossSellIds) {
|
||||||
body.cross_sell_ids = (updateFields.crossSellIds as string).split(',') as string[];
|
body.cross_sell_ids = (updateFields.crossSellIds as string).split(',') as string[];
|
||||||
|
@ -274,9 +271,6 @@ export class WooCommerce implements INodeType {
|
||||||
if (updateFields.parentId) {
|
if (updateFields.parentId) {
|
||||||
body.parent_id = updateFields.parentId as string;
|
body.parent_id = updateFields.parentId as string;
|
||||||
}
|
}
|
||||||
if (updateFields.price) {
|
|
||||||
body.price = updateFields.price as string;
|
|
||||||
}
|
|
||||||
if (updateFields.purchaseNote) {
|
if (updateFields.purchaseNote) {
|
||||||
body.purchase_note = updateFields.purchaseNote as string;
|
body.purchase_note = updateFields.purchaseNote as string;
|
||||||
}
|
}
|
||||||
|
@ -314,7 +308,7 @@ export class WooCommerce implements INodeType {
|
||||||
body.stock_status = updateFields.stockStatus as string;
|
body.stock_status = updateFields.stockStatus as string;
|
||||||
}
|
}
|
||||||
if (updateFields.tags) {
|
if (updateFields.tags) {
|
||||||
body.tags = (updateFields.tags as string[]).map(tag => { id: parseInt(tag, 10); }) as unknown as IDataObject[];
|
body.tags = (updateFields.tags as string[]).map(tag => ({ id: parseInt(tag, 10) })) as unknown as IDataObject[];
|
||||||
}
|
}
|
||||||
if (updateFields.taxClass) {
|
if (updateFields.taxClass) {
|
||||||
body.tax_class = updateFields.taxClass as string;
|
body.tax_class = updateFields.taxClass as string;
|
||||||
|
@ -378,9 +372,6 @@ export class WooCommerce implements INodeType {
|
||||||
if (options.minPrice) {
|
if (options.minPrice) {
|
||||||
qs.max_price = options.minPrice as string;
|
qs.max_price = options.minPrice as string;
|
||||||
}
|
}
|
||||||
if (options.onSale) {
|
|
||||||
qs.on_sale = options.onSale as string;
|
|
||||||
}
|
|
||||||
if (options.order) {
|
if (options.order) {
|
||||||
qs.order = options.order as string;
|
qs.order = options.order as string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,8 +214,8 @@
|
||||||
"dist/nodes/Webflow/WebflowTrigger.node.js",
|
"dist/nodes/Webflow/WebflowTrigger.node.js",
|
||||||
"dist/nodes/Webhook.node.js",
|
"dist/nodes/Webhook.node.js",
|
||||||
"dist/nodes/Wordpress/Wordpress.node.js",
|
"dist/nodes/Wordpress/Wordpress.node.js",
|
||||||
"dist/nodes/WooCommerce/WooCommerceTrigger.node.js",
|
|
||||||
"dist/nodes/WooCommerce/WooCommerce.node.js",
|
"dist/nodes/WooCommerce/WooCommerce.node.js",
|
||||||
|
"dist/nodes/WooCommerce/WooCommerceTrigger.node.js",
|
||||||
"dist/nodes/WriteBinaryFile.node.js",
|
"dist/nodes/WriteBinaryFile.node.js",
|
||||||
"dist/nodes/Xml.node.js",
|
"dist/nodes/Xml.node.js",
|
||||||
"dist/nodes/Zendesk/Zendesk.node.js",
|
"dist/nodes/Zendesk/Zendesk.node.js",
|
||||||
|
|
Loading…
Reference in a new issue