Wp wc tax delete

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen
$ wp help wc tax delete

NAME

  wp wc tax delete

DESCRIPTION

  Delete an existing item.

SYNOPSIS

  wp wc tax delete <id> [--id=<id>] [--force=<force>] [--porcelain]

OPTIONS

  <id>
    The ID for the resource.

  [--id=<id>]
    Unique identifier for the resource.

  [--force=<force>]
    Required to be true, as resource does not support trashing.

  [--porcelain]
    Output just the id when the operation is successful.

Voorbeeld

Ondanks de foutmelding is het commando met succes uitgevoerd:

$ wp wc tax --user=4 delete 4 --force=true

Error: The resource cannot be deleted. {"status":500}

Voorbeeld: Verwijder alle bestaande tarieven

In deze situatie waren er al een hoop tarieven gedefineerd. Die wilde ik graag in één keer verwijderen:

  • Merk opnieuw op, dat je de foutmeldingen kunt negeren
  • Merk op dat de rijen in de tabel ogenschijnlijk ongesorteerd zijn. Gelukkig boeit dat op geen enkele manier.
$ wp --user=4 wc tax list

+----+---------+-------+----------+------+---------+------+----------+----------+----------+-------+-----------+
| id | country | state | postcode | city | rate    | name | priority | compound | shipping | order | class     |
+----+---------+-------+----------+------+---------+------+----------+----------+----------+-------+-----------+
| 44 | IE      |       |          |      | 23.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 57 |         |       |          |      | 0.0000  | VAT  | 1        |          | 1        | 0     | zero-rate |
| 56 | SK      |       |          |      | 20.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 55 | SI      |       |          |      | 22.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 54 | SE      |       |          |      | 25.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 53 | RO      |       |          |      | 19.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 52 | PT      |       |          |      | 23.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 51 | PL      |       |          |      | 23.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 50 | NL      |       |          |      | 21.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 49 | MT      |       |          |      | 18.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 48 | LV      |       |          |      | 21.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 47 | LU      |       |          |      | 17.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 46 | LT      |       |          |      | 21.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 45 | IT      |       |          |      | 22.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 30 | AT      |       |          |      | 20.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 43 | HU      |       |          |      | 27.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 42 | HR      |       |          |      | 25.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 41 | FR      |       |          |      | 20.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 40 | FI      |       |          |      | 24.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 39 | ES      |       |          |      | 21.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 38 | EL      |       |          |      | 24.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 37 | EE      |       |          |      | 20.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 36 | DK      |       |          |      | 25.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 35 | DE      |       |          |      | 19.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 34 | CZ      |       |          |      | 21.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 33 | CY      |       |          |      | 19.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 32 | BG      |       |          |      | 20.0000 | VAT  | 1        |          | 1        | 0     | standard  |
| 31 | BE      |       |          |      | 21.0000 | VAT  | 1        |          | 1        | 0     | standard  |
+----+---------+-------+----------+------+---------+------+----------+----------+----------+-------+-----------+

$ wp --user=4 wc tax list --field=id | xargs -n1 wp --user=4 wc tax delete --force=true

Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}
Error: The resource cannot be deleted. {"status":500}

$ wp --user=4 wc tax list

+----+---------+-------+----------+------+------+------+----------+----------+----------+-------+-------+
| id | country | state | postcode | city | rate | name | priority | compound | shipping | order | class |
+----+---------+-------+----------+------+------+------+----------+----------+----------+-------+-------+
+----+---------+-------+----------+------+------+------+----------+----------+----------+-------+-------+