1. Packages
  2. Commercetools Provider
  3. API Docs
  4. ShippingMethod
commercetools 1.19.3 published on Friday, Apr 4, 2025 by labd

commercetools.ShippingMethod

Explore with Pulumi AI

With Shipping Methods you can specify which shipping services you want to provide to your customers for deliveries to different areas of the world at rates you can define.

See also the Shipping Methods API Documentation

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as commercetools from "@pulumi/commercetools";

const some_tax_category = new commercetools.TaxCategory("some-tax-category", {
    key: "some-tax-category-key",
    description: "test category",
});
const standard = new commercetools.ShippingMethod("standard", {
    key: "standard-key",
    description: "Standard tax category",
    isDefault: true,
    taxCategoryId: some_tax_category.taxCategoryId,
    predicate: "1 = 1",
});
Copy
import pulumi
import pulumi_commercetools as commercetools

some_tax_category = commercetools.TaxCategory("some-tax-category",
    key="some-tax-category-key",
    description="test category")
standard = commercetools.ShippingMethod("standard",
    key="standard-key",
    description="Standard tax category",
    is_default=True,
    tax_category_id=some_tax_category.tax_category_id,
    predicate="1 = 1")
Copy
package main

import (
	"github.com/pulumi/pulumi-terraform-provider/sdks/go/commercetools/commercetools"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		some_tax_category, err := commercetools.NewTaxCategory(ctx, "some-tax-category", &commercetools.TaxCategoryArgs{
			Key:         pulumi.String("some-tax-category-key"),
			Description: pulumi.String("test category"),
		})
		if err != nil {
			return err
		}
		_, err = commercetools.NewShippingMethod(ctx, "standard", &commercetools.ShippingMethodArgs{
			Key:           pulumi.String("standard-key"),
			Description:   pulumi.String("Standard tax category"),
			IsDefault:     pulumi.Bool(true),
			TaxCategoryId: some_tax_category.TaxCategoryId,
			Predicate:     pulumi.String("1 = 1"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Commercetools = Pulumi.Commercetools;

return await Deployment.RunAsync(() => 
{
    var some_tax_category = new Commercetools.TaxCategory("some-tax-category", new()
    {
        Key = "some-tax-category-key",
        Description = "test category",
    });

    var standard = new Commercetools.ShippingMethod("standard", new()
    {
        Key = "standard-key",
        Description = "Standard tax category",
        IsDefault = true,
        TaxCategoryId = some_tax_category.TaxCategoryId,
        Predicate = "1 = 1",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.commercetools.TaxCategory;
import com.pulumi.commercetools.TaxCategoryArgs;
import com.pulumi.commercetools.ShippingMethod;
import com.pulumi.commercetools.ShippingMethodArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var some_tax_category = new TaxCategory("some-tax-category", TaxCategoryArgs.builder()
            .key("some-tax-category-key")
            .description("test category")
            .build());

        var standard = new ShippingMethod("standard", ShippingMethodArgs.builder()
            .key("standard-key")
            .description("Standard tax category")
            .isDefault(true)
            .taxCategoryId(some_tax_category.taxCategoryId())
            .predicate("1 = 1")
            .build());

    }
}
Copy
resources:
  some-tax-category:
    type: commercetools:TaxCategory
    properties:
      key: some-tax-category-key
      description: test category
  standard:
    type: commercetools:ShippingMethod
    properties:
      key: standard-key
      description: Standard tax category
      isDefault: true
      taxCategoryId: ${["some-tax-category"].taxCategoryId}
      predicate: 1 = 1
Copy

Create ShippingMethod Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new ShippingMethod(name: string, args: ShippingMethodArgs, opts?: CustomResourceOptions);
@overload
def ShippingMethod(resource_name: str,
                   args: ShippingMethodArgs,
                   opts: Optional[ResourceOptions] = None)

@overload
def ShippingMethod(resource_name: str,
                   opts: Optional[ResourceOptions] = None,
                   tax_category_id: Optional[str] = None,
                   active: Optional[bool] = None,
                   custom: Optional[ShippingMethodCustomArgs] = None,
                   description: Optional[str] = None,
                   is_default: Optional[bool] = None,
                   key: Optional[str] = None,
                   localized_description: Optional[Mapping[str, str]] = None,
                   localized_name: Optional[Mapping[str, str]] = None,
                   name: Optional[str] = None,
                   predicate: Optional[str] = None,
                   shipping_method_id: Optional[str] = None)
func NewShippingMethod(ctx *Context, name string, args ShippingMethodArgs, opts ...ResourceOption) (*ShippingMethod, error)
public ShippingMethod(string name, ShippingMethodArgs args, CustomResourceOptions? opts = null)
public ShippingMethod(String name, ShippingMethodArgs args)
public ShippingMethod(String name, ShippingMethodArgs args, CustomResourceOptions options)
type: commercetools:ShippingMethod
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ShippingMethodArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ShippingMethodArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ShippingMethodArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ShippingMethodArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ShippingMethodArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var shippingMethodResource = new Commercetools.ShippingMethod("shippingMethodResource", new()
{
    TaxCategoryId = "string",
    Active = false,
    Custom = new Commercetools.Inputs.ShippingMethodCustomArgs
    {
        TypeId = "string",
        Fields = 
        {
            { "string", "string" },
        },
    },
    Description = "string",
    IsDefault = false,
    Key = "string",
    LocalizedDescription = 
    {
        { "string", "string" },
    },
    LocalizedName = 
    {
        { "string", "string" },
    },
    Name = "string",
    Predicate = "string",
    ShippingMethodId = "string",
});
Copy
example, err := commercetools.NewShippingMethod(ctx, "shippingMethodResource", &commercetools.ShippingMethodArgs{
TaxCategoryId: pulumi.String("string"),
Active: pulumi.Bool(false),
Custom: &.ShippingMethodCustomArgs{
TypeId: pulumi.String("string"),
Fields: pulumi.StringMap{
"string": pulumi.String("string"),
},
},
Description: pulumi.String("string"),
IsDefault: pulumi.Bool(false),
Key: pulumi.String("string"),
LocalizedDescription: pulumi.StringMap{
"string": pulumi.String("string"),
},
LocalizedName: pulumi.StringMap{
"string": pulumi.String("string"),
},
Name: pulumi.String("string"),
Predicate: pulumi.String("string"),
ShippingMethodId: pulumi.String("string"),
})
Copy
var shippingMethodResource = new ShippingMethod("shippingMethodResource", ShippingMethodArgs.builder()
    .taxCategoryId("string")
    .active(false)
    .custom(ShippingMethodCustomArgs.builder()
        .typeId("string")
        .fields(Map.of("string", "string"))
        .build())
    .description("string")
    .isDefault(false)
    .key("string")
    .localizedDescription(Map.of("string", "string"))
    .localizedName(Map.of("string", "string"))
    .name("string")
    .predicate("string")
    .shippingMethodId("string")
    .build());
Copy
shipping_method_resource = commercetools.ShippingMethod("shippingMethodResource",
    tax_category_id="string",
    active=False,
    custom={
        "type_id": "string",
        "fields": {
            "string": "string",
        },
    },
    description="string",
    is_default=False,
    key="string",
    localized_description={
        "string": "string",
    },
    localized_name={
        "string": "string",
    },
    name="string",
    predicate="string",
    shipping_method_id="string")
Copy
const shippingMethodResource = new commercetools.ShippingMethod("shippingMethodResource", {
    taxCategoryId: "string",
    active: false,
    custom: {
        typeId: "string",
        fields: {
            string: "string",
        },
    },
    description: "string",
    isDefault: false,
    key: "string",
    localizedDescription: {
        string: "string",
    },
    localizedName: {
        string: "string",
    },
    name: "string",
    predicate: "string",
    shippingMethodId: "string",
});
Copy
type: commercetools:ShippingMethod
properties:
    active: false
    custom:
        fields:
            string: string
        typeId: string
    description: string
    isDefault: false
    key: string
    localizedDescription:
        string: string
    localizedName:
        string: string
    name: string
    predicate: string
    shippingMethodId: string
    taxCategoryId: string
Copy

ShippingMethod Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The ShippingMethod resource accepts the following input properties:

TaxCategoryId This property is required. string
ID of a Tax Category
Active bool
Activate or deactivate a shipping method. Default is active.
Custom ShippingMethodCustom
Description string
IsDefault bool
One shipping method in a project can be default
Key string
User-specific unique identifier for the shipping method
LocalizedDescription Dictionary<string, string>
LocalizedString
LocalizedName Dictionary<string, string>
LocalizedString
Name string
Predicate string
A Cart predicate which can be used to more precisely select a shipping method for a cart
ShippingMethodId string
The ID of this resource.
TaxCategoryId This property is required. string
ID of a Tax Category
Active bool
Activate or deactivate a shipping method. Default is active.
Custom ShippingMethodCustomArgs
Description string
IsDefault bool
One shipping method in a project can be default
Key string
User-specific unique identifier for the shipping method
LocalizedDescription map[string]string
LocalizedString
LocalizedName map[string]string
LocalizedString
Name string
Predicate string
A Cart predicate which can be used to more precisely select a shipping method for a cart
ShippingMethodId string
The ID of this resource.
taxCategoryId This property is required. String
ID of a Tax Category
active Boolean
Activate or deactivate a shipping method. Default is active.
custom ShippingMethodCustom
description String
isDefault Boolean
One shipping method in a project can be default
key String
User-specific unique identifier for the shipping method
localizedDescription Map<String,String>
LocalizedString
localizedName Map<String,String>
LocalizedString
name String
predicate String
A Cart predicate which can be used to more precisely select a shipping method for a cart
shippingMethodId String
The ID of this resource.
taxCategoryId This property is required. string
ID of a Tax Category
active boolean
Activate or deactivate a shipping method. Default is active.
custom ShippingMethodCustom
description string
isDefault boolean
One shipping method in a project can be default
key string
User-specific unique identifier for the shipping method
localizedDescription {[key: string]: string}
LocalizedString
localizedName {[key: string]: string}
LocalizedString
name string
predicate string
A Cart predicate which can be used to more precisely select a shipping method for a cart
shippingMethodId string
The ID of this resource.
tax_category_id This property is required. str
ID of a Tax Category
active bool
Activate or deactivate a shipping method. Default is active.
custom ShippingMethodCustomArgs
description str
is_default bool
One shipping method in a project can be default
key str
User-specific unique identifier for the shipping method
localized_description Mapping[str, str]
LocalizedString
localized_name Mapping[str, str]
LocalizedString
name str
predicate str
A Cart predicate which can be used to more precisely select a shipping method for a cart
shipping_method_id str
The ID of this resource.
taxCategoryId This property is required. String
ID of a Tax Category
active Boolean
Activate or deactivate a shipping method. Default is active.
custom Property Map
description String
isDefault Boolean
One shipping method in a project can be default
key String
User-specific unique identifier for the shipping method
localizedDescription Map<String>
LocalizedString
localizedName Map<String>
LocalizedString
name String
predicate String
A Cart predicate which can be used to more precisely select a shipping method for a cart
shippingMethodId String
The ID of this resource.

Outputs

All input properties are implicitly available as output properties. Additionally, the ShippingMethod resource produces the following output properties:

Id string
The provider-assigned unique ID for this managed resource.
Version double
Id string
The provider-assigned unique ID for this managed resource.
Version float64
id String
The provider-assigned unique ID for this managed resource.
version Double
id string
The provider-assigned unique ID for this managed resource.
version number
id str
The provider-assigned unique ID for this managed resource.
version float
id String
The provider-assigned unique ID for this managed resource.
version Number

Look up Existing ShippingMethod Resource

Get an existing ShippingMethod resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: ShippingMethodState, opts?: CustomResourceOptions): ShippingMethod
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        active: Optional[bool] = None,
        custom: Optional[ShippingMethodCustomArgs] = None,
        description: Optional[str] = None,
        is_default: Optional[bool] = None,
        key: Optional[str] = None,
        localized_description: Optional[Mapping[str, str]] = None,
        localized_name: Optional[Mapping[str, str]] = None,
        name: Optional[str] = None,
        predicate: Optional[str] = None,
        shipping_method_id: Optional[str] = None,
        tax_category_id: Optional[str] = None,
        version: Optional[float] = None) -> ShippingMethod
func GetShippingMethod(ctx *Context, name string, id IDInput, state *ShippingMethodState, opts ...ResourceOption) (*ShippingMethod, error)
public static ShippingMethod Get(string name, Input<string> id, ShippingMethodState? state, CustomResourceOptions? opts = null)
public static ShippingMethod get(String name, Output<String> id, ShippingMethodState state, CustomResourceOptions options)
resources:  _:    type: commercetools:ShippingMethod    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Active bool
Activate or deactivate a shipping method. Default is active.
Custom ShippingMethodCustom
Description string
IsDefault bool
One shipping method in a project can be default
Key string
User-specific unique identifier for the shipping method
LocalizedDescription Dictionary<string, string>
LocalizedString
LocalizedName Dictionary<string, string>
LocalizedString
Name string
Predicate string
A Cart predicate which can be used to more precisely select a shipping method for a cart
ShippingMethodId string
The ID of this resource.
TaxCategoryId string
ID of a Tax Category
Version double
Active bool
Activate or deactivate a shipping method. Default is active.
Custom ShippingMethodCustomArgs
Description string
IsDefault bool
One shipping method in a project can be default
Key string
User-specific unique identifier for the shipping method
LocalizedDescription map[string]string
LocalizedString
LocalizedName map[string]string
LocalizedString
Name string
Predicate string
A Cart predicate which can be used to more precisely select a shipping method for a cart
ShippingMethodId string
The ID of this resource.
TaxCategoryId string
ID of a Tax Category
Version float64
active Boolean
Activate or deactivate a shipping method. Default is active.
custom ShippingMethodCustom
description String
isDefault Boolean
One shipping method in a project can be default
key String
User-specific unique identifier for the shipping method
localizedDescription Map<String,String>
LocalizedString
localizedName Map<String,String>
LocalizedString
name String
predicate String
A Cart predicate which can be used to more precisely select a shipping method for a cart
shippingMethodId String
The ID of this resource.
taxCategoryId String
ID of a Tax Category
version Double
active boolean
Activate or deactivate a shipping method. Default is active.
custom ShippingMethodCustom
description string
isDefault boolean
One shipping method in a project can be default
key string
User-specific unique identifier for the shipping method
localizedDescription {[key: string]: string}
LocalizedString
localizedName {[key: string]: string}
LocalizedString
name string
predicate string
A Cart predicate which can be used to more precisely select a shipping method for a cart
shippingMethodId string
The ID of this resource.
taxCategoryId string
ID of a Tax Category
version number
active bool
Activate or deactivate a shipping method. Default is active.
custom ShippingMethodCustomArgs
description str
is_default bool
One shipping method in a project can be default
key str
User-specific unique identifier for the shipping method
localized_description Mapping[str, str]
LocalizedString
localized_name Mapping[str, str]
LocalizedString
name str
predicate str
A Cart predicate which can be used to more precisely select a shipping method for a cart
shipping_method_id str
The ID of this resource.
tax_category_id str
ID of a Tax Category
version float
active Boolean
Activate or deactivate a shipping method. Default is active.
custom Property Map
description String
isDefault Boolean
One shipping method in a project can be default
key String
User-specific unique identifier for the shipping method
localizedDescription Map<String>
LocalizedString
localizedName Map<String>
LocalizedString
name String
predicate String
A Cart predicate which can be used to more precisely select a shipping method for a cart
shippingMethodId String
The ID of this resource.
taxCategoryId String
ID of a Tax Category
version Number

Supporting Types

ShippingMethodCustom
, ShippingMethodCustomArgs

TypeId This property is required. string
Fields Dictionary<string, string>
Custom fields for this resource. Note that the values need to be provided as JSON encoded strings: my-value = jsonencode({"key": "value"})
TypeId This property is required. string
Fields map[string]string
Custom fields for this resource. Note that the values need to be provided as JSON encoded strings: my-value = jsonencode({"key": "value"})
typeId This property is required. String
fields Map<String,String>
Custom fields for this resource. Note that the values need to be provided as JSON encoded strings: my-value = jsonencode({"key": "value"})
typeId This property is required. string
fields {[key: string]: string}
Custom fields for this resource. Note that the values need to be provided as JSON encoded strings: my-value = jsonencode({"key": "value"})
type_id This property is required. str
fields Mapping[str, str]
Custom fields for this resource. Note that the values need to be provided as JSON encoded strings: my-value = jsonencode({"key": "value"})
typeId This property is required. String
fields Map<String>
Custom fields for this resource. Note that the values need to be provided as JSON encoded strings: my-value = jsonencode({"key": "value"})

Package Details

Repository
commercetools labd/terraform-provider-commercetools
License
Notes
This Pulumi package is based on the commercetools Terraform Provider.