This commit is contained in:
paoloar77
2024-05-18 13:16:38 +02:00
parent 60ab435ac1
commit 575afc090a

View File

@@ -6061,9 +6061,28 @@ Route::get('/aggiornapreorder/{idarticolo}/{postid}', function ($idarticolo, $po
$product = Product::where('sku', $idarticolo)->first();
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) {
dd($metadata);