私は配列を持っています。print_r この配列の結果は次のとおりです。
Array
(
[flat_rate] => WC_Shipping_Rate Object
(
[id] => flat_rate
[label] => book
[cost] => 8000
[taxes] => Array
(
)
[method_id] => flat_rate
)
[local_delivery] => WC_Shipping_Rate Object
(
[id] => local_delivery
[label] => dvd
[cost] => 15000
[taxes] => Array
(
)
[method_id] => local_delivery
)
)
このような配列を作成する必要があります。私はこのコードでこの配列を試します:
Array("flat_rate" => (object) Array("id" => "flat_rate" ,"label" => "book" ,"cost" => 8000 ,"taxes" => Array ( ) ,"method_id" => "flat_rate") ,"local_delivery" => (object) Array("id" => "local_delivery" ,"label" => "book" ,"cost" => 15000 ,"taxes" => Array ( ) ,"method_id" => "local_delivery"));
しかし、この配列をprint_rすると、stdClassによってWC_Shipping_Rateが変化します