test
This commit is contained in:
@@ -6061,9 +6061,28 @@ Route::get('/aggiornapreorder/{idarticolo}/{postid}', function ($idarticolo, $po
|
|||||||
$product = Product::where('sku', $idarticolo)->first();
|
$product = Product::where('sku', $idarticolo)->first();
|
||||||
|
|
||||||
if ($product) {
|
if ($product) {
|
||||||
// dd($product);
|
dd($product);
|
||||||
|
|
||||||
$metadata = WpPostMeta::where('post_id', $postid)->get();
|
$preorder = true;
|
||||||
|
|
||||||
|
if ($preorder) {
|
||||||
|
$product->stock_status = 'preorder';
|
||||||
|
|
||||||
|
// Modifica la data di preordine del prodotto (ad esempio impostandola a oggi)
|
||||||
|
$product->meta_data = [
|
||||||
|
[
|
||||||
|
'key' => '_preorder_date',
|
||||||
|
'value' => now()->format('Y-m-d H:i:s')
|
||||||
|
]
|
||||||
|
];
|
||||||
|
|
||||||
|
// Salva le modifiche
|
||||||
|
$product->save();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$metadata = null;
|
||||||
|
// $metadata = WpPostMeta::where('post_id', $postid)->get();
|
||||||
|
|
||||||
if ($metadata) {
|
if ($metadata) {
|
||||||
dd($metadata);
|
dd($metadata);
|
||||||
|
|||||||
Reference in New Issue
Block a user