1

How can I check if the cart has any shippable product in Ubercart 3 for Drupal 8? Previous version had uc_cart_is_shippable() method which Drupal 8 module does not seem to have by default.

Is there a separate/additional module to get this function working? Or how else can I check if the cart has a shippable product?

1

The function is now a part of the CartInterface and implemented in the Cart::isShippable() method. You can use the CartManager service to retrieve the Cart object and call the method:

\Drupal::service('uc_cart.manager')->get()->isShippable()
  • Thanks @Shawn Conn – Prerit Mohan Mar 30 '19 at 20:37
  • do we have the equivalent function for uc_cart_product_is_shippable() as well? – Prerit Mohan Mar 31 '19 at 12:10

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.