I try to bring the amount of the shipment from the backend without javascript. But when the cart page is displayed for the first time, the shipping amount is displayed as follows:

enter image description here

but when I refresh the page, then the amount of the shipment is shown as it should be:

enter image description here

This is my backend code, to get the shipping amount:

$cart = $objectManager->get('\Magento\Checkout\Model\Cart');

<td>Shipping (<?php echo $shipping_amountc; ?>) </td>
<td align="right"><?php echo number_format($shipping_amount,2);?></td>

Is there any way to bring the shipping amount without refreshing the page? please who can help me, I appreciate it!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.